Repeat-one-song doesn't work with some particular songs
Lhatna7N0l opened this issue · 3 comments
I have some mp3 files downloaded from mp3quack.com which are modified with ffmpeg by myself to change/remove their covers,and some other mp3/flac/wav/other files.Let me call them Group A and Group B.
I find that when they are in the same playlist and next to each other,the repeat-one-song will not work.For example,3 songs from Group A and 3 songs from Group B are in a playlist like below,the repeat-one song feature fails when playing A3 and B3,cause they are followed by a song from the other group.While it works well when playing A1,A2,B1,B2.
|A1 |
|A2 |
|A3 |
|B1 |
|B2 |
|B3 |
This problem doesn't occur on edumucelli's repeat-one-song -> https://github.com/edumucelli/repeat-one-song .Perhaps their would be some hints.
The repeat code is here - so that's an area to investigate https://github.com/fossfreedom/alternative-toolbar/blob/master/alttoolbar_repeat.py#L133
Sorry for the long time.Since I know little about python,I spent some time to learn and read your code.
I noticed your repeat code is similar with @edumucelli's,while there is a different in the actual practice which may related to my issue.
Both your code has an if statement:
if time >= duration - 2: player.set_playing_time(0)
Which means to return to the beginning when a song has 2 sec left.
While in his plugin it works precisely to repeat when there were 2 sec left,in your toolbar it always goes to the end and repeat - or not,in my occasion.If you try to modify both of the code,for example to change 2 to 60,his will repeat when a song has 1 minute left,but yours won't change.(I modified /usr/lib/rhythmbox/plugins/alternative-toolbar/alttoolbar_repeat.py,is that right?)
I hadn't read all your code,but the only file had alttoolbar_repeat imported seems to be alttoolbar_type.py.I guess is the timing to call the function in alttoolbar_repeat that makes the difference.
And also,by @edumucelli's comment,RB use the last sec of a song to load next song's information.By using your toolbars,sometimes the repeat works correctly,but the cover of the song becomes the next's.This situation may proof my word above.
I think I can hardly process anymore myself,so I decided to report what I find.Hope you can find out something.
I found the solution.
Though the on_elapsed_change method exist,you didn't connect it to anything.While this is the way edumucelli used.
I add a line
player.connect('elapsed-changed', self.on_elapsed_change)
after
alternative-toolbar/alttoolbar_repeat.py
Line 55 in 9f2c27b
and it worked.
I don't know why but the eos way sometimes fail for me.