This is fast dirty hack. But it works (only for library, nothing else). You can dowload plugin here. Just download it and extract it into ~/.gnome2/rhythmbox/plugins directory. Have fun!
Source code: resume_on_restart/__init__.py
- #!/usr/bin/python
- #
- # This program is under GPLv3 license --
- # http://www.gnu.org/licenses/gpl-3.0.html
- #
- # If you think, that this script is usefull, please send me a postcard to
- # adress:
- # Michal Nanasi
- # Azalkova 1
- # 82101 Bratislava
- # Slovakia
- import rb,rhythmdb,time
- class ResumeOnPlaying (rb.Plugin):
- def __init__(self):
- rb.Plugin.__init__(self)
- def activate(self, shell):
- print "HALUZ"
- self.shell = shell
- self.db=shell.get_property("db")
- self.player=shell.get_player()
- self.pec_id = self.player.connect('playing-song-changed',self.playing_song_changed)
- f=open(self.find_file("resume_on_restart.save"),"r")
- self.to_change=f.readline()
- f.close();
- def deactivate(self, shell):
- del self.shell
- self.player.disconnect(self.pec_id)
- try:
- location=self.db.entry_get(self.player.get_playing_entry(),rhythmdb.PROP_LOCATION)
- print location
- f=open(self.find_file("resume_on_restart.save"),'w')
- f.write(location)
- f.close()
- except:
- print "Error"
- def playing_song_changed(self, sp, entry):
- if self.to_change is not "Not":
- try:
- self.player.play_entry(self.db.entry_lookup_by_location(self.to_change))
- except:
- print "Error"
- self.to_change="Not"
- if entry is not None:
- try:
- location=self.db.entry_get(entry,rhythmdb.PROP_LOCATION)
- print location
- f=open(self.find_file("resume_on_restart.save"),'w')
- f.write(location)
- f.close()
- except:
- print "ERROR"
Source code: resume_on_restart/resume_on_restart.rb-plugin
- [RB Plugin]
- Loader=python
- Module=resume_on_restart
- IAge=1
- Name=Resume on restart
- Description=Remember last played song and play it as first song after rhythmbox restarts.
- Authors=Michal Nánási (mic(at)rhythmboxplugin.ksp.sk)
- Copyright=This program is under GPLv3 license -- http://www.gnu.org/licenses/gpl-3.0.html
- Website=http://people.ksp.sk/~mic/Projects/RhythmboxROR
