shroom 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/sh_cover_art.rb +1 -1
- data/lib/sh_global.rb +50 -15
- data/lib/sh_lyrics.rb +40 -10
- data/lib/sh_main.rb +5 -0
- data/lib/sh_player.rb +44 -87
- data/lib/sh_plugin.rb +44 -0
- data/lib/sh_song.rb +11 -7
- data/lib/sh_tagreader.rb +16 -15
- data/lib/sh_util.rb +22 -1
- data/lib/sh_view.rb +114 -35
- data/lib/shroom-res/cover_unavailable.png +0 -0
- data/lib/shroom-res/cover_unavailable.svg +152 -0
- data/lib/shroom-res/plugins/lastfm_scrobbler.rb +71 -0
- data/lib/shroom-res/shroom.glade +135 -0
- metadata +7 -2
Binary file
|
@@ -0,0 +1,152 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
<svg
|
4
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
5
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
6
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
7
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
9
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
10
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
11
|
+
width="381.42856"
|
12
|
+
height="381.42856"
|
13
|
+
id="svg2"
|
14
|
+
sodipodi:version="0.32"
|
15
|
+
inkscape:version="0.46"
|
16
|
+
version="1.0"
|
17
|
+
sodipodi:docname="cover_unavailable.svg"
|
18
|
+
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
19
|
+
<defs
|
20
|
+
id="defs4">
|
21
|
+
<inkscape:perspective
|
22
|
+
sodipodi:type="inkscape:persp3d"
|
23
|
+
inkscape:vp_x="0 : 526.18109 : 1"
|
24
|
+
inkscape:vp_y="0 : 1000 : 0"
|
25
|
+
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
26
|
+
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
27
|
+
id="perspective10" />
|
28
|
+
</defs>
|
29
|
+
<sodipodi:namedview
|
30
|
+
id="base"
|
31
|
+
pagecolor="#ffffff"
|
32
|
+
bordercolor="#666666"
|
33
|
+
borderopacity="1.0"
|
34
|
+
gridtolerance="10000"
|
35
|
+
guidetolerance="10"
|
36
|
+
objecttolerance="10"
|
37
|
+
inkscape:pageopacity="0.0"
|
38
|
+
inkscape:pageshadow="2"
|
39
|
+
inkscape:zoom="0.7"
|
40
|
+
inkscape:cx="320.64007"
|
41
|
+
inkscape:cy="345.12853"
|
42
|
+
inkscape:document-units="px"
|
43
|
+
inkscape:current-layer="layer1"
|
44
|
+
showgrid="false"
|
45
|
+
inkscape:window-width="1280"
|
46
|
+
inkscape:window-height="972"
|
47
|
+
inkscape:window-x="0"
|
48
|
+
inkscape:window-y="0" />
|
49
|
+
<metadata
|
50
|
+
id="metadata7">
|
51
|
+
<rdf:RDF>
|
52
|
+
<cc:Work
|
53
|
+
rdf:about="">
|
54
|
+
<dc:format>image/svg+xml</dc:format>
|
55
|
+
<dc:type
|
56
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
57
|
+
</cc:Work>
|
58
|
+
</rdf:RDF>
|
59
|
+
</metadata>
|
60
|
+
<g
|
61
|
+
inkscape:label="Layer 1"
|
62
|
+
inkscape:groupmode="layer"
|
63
|
+
id="layer1"
|
64
|
+
transform="translate(-78.571434,-149.50504)">
|
65
|
+
<rect
|
66
|
+
style="fill:#f9f9f9;stroke:none"
|
67
|
+
id="rect2443"
|
68
|
+
width="381.42856"
|
69
|
+
height="381.42856"
|
70
|
+
x="78.571434"
|
71
|
+
y="149.50504" />
|
72
|
+
<g
|
73
|
+
id="g2435"
|
74
|
+
style="stroke:none">
|
75
|
+
<path
|
76
|
+
sodipodi:nodetypes="csscc"
|
77
|
+
id="path2383"
|
78
|
+
d="M 291.42857,268.07647 C 242.09733,308.91545 179.32004,340.42259 165.71429,413.79075 C 151.7914,488.86906 234.21959,487.07658 238.57143,448.07646 C 248.05394,363.09655 297.65886,347.77628 361.42857,316.6479 L 291.42857,268.07647 z"
|
79
|
+
style="fill:#f4eed7;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
80
|
+
<path
|
81
|
+
sodipodi:nodetypes="ccsc"
|
82
|
+
id="path2385"
|
83
|
+
d="M 196.47008,231.47362 C 182.44969,251.33186 336.04035,423.14066 362.96322,412.13253 C 362.96322,412.13253 441.04616,314.71479 369.23136,243.13276 C 279.66804,153.85971 196.47008,231.47362 196.47008,231.47362 z"
|
84
|
+
style="fill:#e3dbdb;fill-rule:evenodd;stroke:none;stroke-width:0.8903318px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
85
|
+
<path
|
86
|
+
id="path2397"
|
87
|
+
d="M 369.22334,243.12705 C 360.69876,246.24585 354.9784,252.10661 351.77125,263.60006 C 347.74687,278.02224 371.0174,286.3003 381.73527,284.45769 C 385.65493,283.78382 389.66033,281.84031 393.16416,279.13981 C 388.41962,266.81197 380.76555,254.63185 369.22334,243.12705 z"
|
88
|
+
style="fill:#f9f9f9;fill-rule:evenodd;stroke:none;stroke-width:0.8903318px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
89
|
+
<path
|
90
|
+
sodipodi:nodetypes="csscc"
|
91
|
+
id="path2387"
|
92
|
+
d="M 254.94698,226.67275 C 247.95049,238.38788 268.22351,248.90106 275.64028,250.71507 C 289.18069,254.02679 298.84971,249.45522 309.88972,243.90691 C 320.43777,238.60585 319.25221,226.4191 313.56774,219.81466 C 292.68145,203.64386 272.15885,203.78965 254.94698,226.67275 z"
|
93
|
+
style="fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:0.6542201px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
94
|
+
<path
|
95
|
+
id="path2402"
|
96
|
+
d="M 263.76512,285.09005 C 251.72283,284.64748 240.52368,290.44177 237.104,301.73991 C 246.93918,313.80633 257.82903,326.29465 269.01783,338.41223 C 276.64461,337.92525 284.43932,335.36996 292.20342,332.18825 C 314.27336,323.14402 296.49686,303.58325 285.11016,292.98682 C 278.6965,287.93922 271.08217,285.35897 263.76512,285.09005 z"
|
97
|
+
style="fill:#f9f9f9;fill-rule:evenodd;stroke:none;stroke-width:0.8903318px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
98
|
+
<path
|
99
|
+
id="path2389"
|
100
|
+
d="M 377.31848,353.24079 C 366.98476,339.56774 353.52338,317.37162 335.95136,331.55225 C 325.0707,340.33295 343.24109,361.05816 348.37485,367.41969 C 357.51566,378.74658 369.77322,378.17982 377.82544,367.51752 C 380.28838,364.25622 377.74719,355.20072 377.31848,353.24079 z"
|
101
|
+
style="fill:#f9f9f9;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
102
|
+
</g>
|
103
|
+
<text
|
104
|
+
xml:space="preserve"
|
105
|
+
style="font-size:51.94473648px;font-style:normal;font-weight:normal;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
106
|
+
x="274.08447"
|
107
|
+
y="316.94168"
|
108
|
+
id="text2424"><tspan
|
109
|
+
sodipodi:role="line"
|
110
|
+
id="tspan2426"
|
111
|
+
x="274.08447"
|
112
|
+
y="316.94168"
|
113
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#4d4d4d;-inkscape-font-specification:Bitstream Vera Sans Bold">Cover</tspan><tspan
|
114
|
+
sodipodi:role="line"
|
115
|
+
x="274.08447"
|
116
|
+
y="381.87259"
|
117
|
+
id="tspan2428"
|
118
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#4d4d4d;-inkscape-font-specification:Bitstream Vera Sans Bold">Unavailable</tspan></text>
|
119
|
+
<text
|
120
|
+
id="text2445"
|
121
|
+
y="312.65598"
|
122
|
+
x="270.37018"
|
123
|
+
style="font-size:51.94473648px;font-style:normal;font-weight:normal;fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
124
|
+
xml:space="preserve"><tspan
|
125
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#e6e6e6;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
126
|
+
y="312.65598"
|
127
|
+
x="270.37018"
|
128
|
+
id="tspan2447"
|
129
|
+
sodipodi:role="line">Cover</tspan><tspan
|
130
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#e6e6e6;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
131
|
+
id="tspan2449"
|
132
|
+
y="377.58688"
|
133
|
+
x="270.37018"
|
134
|
+
sodipodi:role="line">Unavailable</tspan></text>
|
135
|
+
<text
|
136
|
+
xml:space="preserve"
|
137
|
+
style="font-size:51.94473648px;font-style:normal;font-weight:normal;fill:#999999;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
|
138
|
+
x="272.37018"
|
139
|
+
y="314.65598"
|
140
|
+
id="text2412"><tspan
|
141
|
+
sodipodi:role="line"
|
142
|
+
id="tspan2414"
|
143
|
+
x="272.37018"
|
144
|
+
y="314.65598"
|
145
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#999999;-inkscape-font-specification:Bitstream Vera Sans Bold">Cover</tspan><tspan
|
146
|
+
sodipodi:role="line"
|
147
|
+
x="272.37018"
|
148
|
+
y="379.58688"
|
149
|
+
id="tspan2416"
|
150
|
+
style="font-weight:bold;text-align:center;text-anchor:middle;fill:#999999;-inkscape-font-specification:Bitstream Vera Sans Bold">Unavailable</tspan></text>
|
151
|
+
</g>
|
152
|
+
</svg>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'ping'
|
2
|
+
require 'thread'
|
3
|
+
|
4
|
+
Sh::Plugin.define "lastfm_scrobbler" do
|
5
|
+
name "Last.fm Scrobbler"
|
6
|
+
description "This plugin submits listening data to Last.fm (http://last.fm/)."
|
7
|
+
author "Aiden Nibali"
|
8
|
+
version "0.0.1"
|
9
|
+
|
10
|
+
@scrobble_queue = []
|
11
|
+
|
12
|
+
# This method is called when a song stops playing (not paused, but stopped)
|
13
|
+
def on_player_stopped player
|
14
|
+
if Sh::Global.prefs[:lastfm]
|
15
|
+
song, play_time, duration = player.song, player.play_time, player.duration
|
16
|
+
if play_time > 240 or (play_time > duration / 2 and duration > 30)
|
17
|
+
@scrobble_queue.insert 0, {
|
18
|
+
:artist => song.artist.name,
|
19
|
+
:track => song.title,
|
20
|
+
:album => song.album.title,
|
21
|
+
:time => Time.new,
|
22
|
+
:length => duration,
|
23
|
+
:track_number => song.track_num
|
24
|
+
}
|
25
|
+
|
26
|
+
# Scrobble if Audioscrobbler is reachable
|
27
|
+
submit_scrobbles! if Ping.pingecho("post.audioscrobbler.com", 10)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def submit_scrobbles!
|
33
|
+
(@mutex ||= Mutex.new).synchronize do
|
34
|
+
auth = @scrobble_auth
|
35
|
+
if not auth or auth.status.strip.upcase != 'OK'
|
36
|
+
user, pass = Sh::Global.prefs[:lastfm_user], Sh::Global.prefs[:lastfm_password]
|
37
|
+
begin
|
38
|
+
auth = @scrobble_auth = Scrobbler::SimpleAuth.new(:user => user, :password => pass)
|
39
|
+
auth.handshake!
|
40
|
+
puts "Last.fm authentication status: #{auth.status}"
|
41
|
+
rescue
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# No point attempting to scrobble without authentication
|
46
|
+
if auth.status and auth.status.strip.upcase == 'OK'
|
47
|
+
failed_scrobbles = []
|
48
|
+
until @scrobble_queue.empty?
|
49
|
+
hash = @scrobble_queue.pop
|
50
|
+
hash[:session_id] = auth.session_id
|
51
|
+
hash[:submission_url] = auth.submission_url
|
52
|
+
scrobble = nil
|
53
|
+
begin
|
54
|
+
scrobble = Scrobbler::Scrobble.new(hash)
|
55
|
+
scrobble.submit!
|
56
|
+
rescue
|
57
|
+
scrobble = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
if scrobble and scrobble.status.strip.upcase == 'OK'
|
61
|
+
puts "Scrobble for '#{scrobble.track}' succeeded"
|
62
|
+
else
|
63
|
+
puts "Warning: Scrobble for '#{scrobble.track}' failed"
|
64
|
+
failed_scrobbles.insert 0, hash
|
65
|
+
end
|
66
|
+
end
|
67
|
+
@scrobble_queue.push *failed_scrobbles
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/shroom-res/shroom.glade
CHANGED
@@ -527,4 +527,139 @@
|
|
527
527
|
</widget>
|
528
528
|
</child>
|
529
529
|
</widget>
|
530
|
+
<widget class="GtkDialog" id="dlg_plugins">
|
531
|
+
<property name="border_width">5</property>
|
532
|
+
<property name="type_hint">normal</property>
|
533
|
+
<property name="has_separator">False</property>
|
534
|
+
<child internal-child="vbox">
|
535
|
+
<widget class="GtkVBox" id="dialog-vbox4">
|
536
|
+
<property name="visible">True</property>
|
537
|
+
<property name="orientation">vertical</property>
|
538
|
+
<property name="spacing">2</property>
|
539
|
+
<child>
|
540
|
+
<widget class="GtkHPaned" id="hpaned1">
|
541
|
+
<property name="visible">True</property>
|
542
|
+
<property name="can_focus">True</property>
|
543
|
+
<property name="position">250</property>
|
544
|
+
<child>
|
545
|
+
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
546
|
+
<property name="visible">True</property>
|
547
|
+
<property name="can_focus">True</property>
|
548
|
+
<property name="hscrollbar_policy">automatic</property>
|
549
|
+
<property name="vscrollbar_policy">automatic</property>
|
550
|
+
<child>
|
551
|
+
<widget class="GtkTreeView" id="lst_plugins">
|
552
|
+
<property name="visible">True</property>
|
553
|
+
<property name="can_focus">True</property>
|
554
|
+
</widget>
|
555
|
+
</child>
|
556
|
+
</widget>
|
557
|
+
<packing>
|
558
|
+
<property name="resize">False</property>
|
559
|
+
<property name="shrink">True</property>
|
560
|
+
</packing>
|
561
|
+
</child>
|
562
|
+
<child>
|
563
|
+
<widget class="GtkVBox" id="vbox1">
|
564
|
+
<property name="visible">True</property>
|
565
|
+
<property name="orientation">vertical</property>
|
566
|
+
<child>
|
567
|
+
<widget class="GtkLabel" id="lbl_name">
|
568
|
+
<property name="visible">True</property>
|
569
|
+
<property name="label" translatable="yes"><b>Foobar</b></property>
|
570
|
+
<property name="use_markup">True</property>
|
571
|
+
</widget>
|
572
|
+
<packing>
|
573
|
+
<property name="expand">False</property>
|
574
|
+
<property name="position">0</property>
|
575
|
+
</packing>
|
576
|
+
</child>
|
577
|
+
<child>
|
578
|
+
<widget class="GtkLabel" id="lbl_version">
|
579
|
+
<property name="visible">True</property>
|
580
|
+
<property name="xalign">1</property>
|
581
|
+
<property name="label" translatable="yes"><i>0.0.0</i></property>
|
582
|
+
<property name="use_markup">True</property>
|
583
|
+
</widget>
|
584
|
+
<packing>
|
585
|
+
<property name="expand">False</property>
|
586
|
+
<property name="position">1</property>
|
587
|
+
</packing>
|
588
|
+
</child>
|
589
|
+
<child>
|
590
|
+
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
591
|
+
<property name="visible">True</property>
|
592
|
+
<property name="can_focus">True</property>
|
593
|
+
<property name="hscrollbar_policy">automatic</property>
|
594
|
+
<property name="vscrollbar_policy">automatic</property>
|
595
|
+
<child>
|
596
|
+
<widget class="GtkTextView" id="txt_description">
|
597
|
+
<property name="visible">True</property>
|
598
|
+
<property name="can_focus">True</property>
|
599
|
+
<property name="editable">False</property>
|
600
|
+
<property name="wrap_mode">word</property>
|
601
|
+
<property name="text" translatable="yes">Description goes here, and may be fairly long.</property>
|
602
|
+
</widget>
|
603
|
+
</child>
|
604
|
+
</widget>
|
605
|
+
<packing>
|
606
|
+
<property name="position">2</property>
|
607
|
+
</packing>
|
608
|
+
</child>
|
609
|
+
<child>
|
610
|
+
<widget class="GtkButton" id="btn_preferences">
|
611
|
+
<property name="label" translatable="yes">gtk-preferences</property>
|
612
|
+
<property name="visible">True</property>
|
613
|
+
<property name="can_focus">True</property>
|
614
|
+
<property name="receives_default">True</property>
|
615
|
+
<property name="use_stock">True</property>
|
616
|
+
</widget>
|
617
|
+
<packing>
|
618
|
+
<property name="expand">False</property>
|
619
|
+
<property name="fill">False</property>
|
620
|
+
<property name="position">3</property>
|
621
|
+
</packing>
|
622
|
+
</child>
|
623
|
+
</widget>
|
624
|
+
<packing>
|
625
|
+
<property name="resize">True</property>
|
626
|
+
<property name="shrink">True</property>
|
627
|
+
</packing>
|
628
|
+
</child>
|
629
|
+
</widget>
|
630
|
+
<packing>
|
631
|
+
<property name="position">1</property>
|
632
|
+
</packing>
|
633
|
+
</child>
|
634
|
+
<child internal-child="action_area">
|
635
|
+
<widget class="GtkHButtonBox" id="dialog-action_area4">
|
636
|
+
<property name="visible">True</property>
|
637
|
+
<property name="layout_style">end</property>
|
638
|
+
<child>
|
639
|
+
<placeholder/>
|
640
|
+
</child>
|
641
|
+
<child>
|
642
|
+
<widget class="GtkButton" id="btn_ok">
|
643
|
+
<property name="label" translatable="yes">gtk-ok</property>
|
644
|
+
<property name="visible">True</property>
|
645
|
+
<property name="can_focus">True</property>
|
646
|
+
<property name="receives_default">True</property>
|
647
|
+
<property name="use_stock">True</property>
|
648
|
+
</widget>
|
649
|
+
<packing>
|
650
|
+
<property name="expand">False</property>
|
651
|
+
<property name="fill">False</property>
|
652
|
+
<property name="position">1</property>
|
653
|
+
</packing>
|
654
|
+
</child>
|
655
|
+
</widget>
|
656
|
+
<packing>
|
657
|
+
<property name="expand">False</property>
|
658
|
+
<property name="pack_type">end</property>
|
659
|
+
<property name="position">0</property>
|
660
|
+
</packing>
|
661
|
+
</child>
|
662
|
+
</widget>
|
663
|
+
</child>
|
664
|
+
</widget>
|
530
665
|
</glade-interface>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shroom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aiden Nibali
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-18 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/sh_playlist.rb
|
135
135
|
- lib/sh_song.rb
|
136
136
|
- lib/sh_artist.rb
|
137
|
+
- lib/sh_plugin.rb
|
137
138
|
- lib/sh_cover_art.rb
|
138
139
|
- lib/sh_tagreader.rb
|
139
140
|
- lib/sh_lyrics.rb
|
@@ -141,10 +142,14 @@ files:
|
|
141
142
|
- lib/sh_util.rb
|
142
143
|
- lib/sh_mmkeys.rb
|
143
144
|
- lib/shroom-res
|
145
|
+
- lib/shroom-res/cover_unavailable.png
|
144
146
|
- lib/shroom-res/icon_16x16.png
|
147
|
+
- lib/shroom-res/plugins
|
148
|
+
- lib/shroom-res/plugins/lastfm_scrobbler.rb
|
145
149
|
- lib/shroom-res/icon.svg
|
146
150
|
- lib/shroom-res/icon_128x128.png
|
147
151
|
- lib/shroom-res/shroom.glade
|
152
|
+
- lib/shroom-res/cover_unavailable.svg
|
148
153
|
- lib/sh_player.rb
|
149
154
|
- lib/sh_view.rb
|
150
155
|
has_rdoc: true
|