SecUpwN / Spotify-AdKiller

Your Party with Spotify - without ads!
https://github.com/SecUpwN/Spotify-AdKiller
GNU General Public License v3.0
836 stars 83 forks source link

Spotify-AdKiller only working manually #7

Closed SecUpwN closed 10 years ago

SecUpwN commented 10 years ago

Good evening, @Feltzer, I must admit that I have another Issue with the current version of our great script: It doesn't seem to work until I manually start it. I only realized that when I noticed that even if I place spotify-adkiller.sh and spotify-wrapper.sh into /usr/bin/ where the I also placed the Spotify-Binary and that Ads can play. I then manuelly started spotify-adkiller.sh from terminal - and then it (partly) worked. Why "partly"? Because it once in a while classified every song after the first Ad as another Ad, thus muting all songs. Wait a second.. is that the WARNING you mentioned in the script? I resolved it myself by just starting spotify-adkiller.sh manually once more.

Did I set it up wrong somehow? How come it sometimes doesn't work? Possibly because I minimized the Spotify-Window? Is it possible to update the script to work even when Spotify is minimized?

Feltzer commented 10 years ago

Mmh, that's strange. It's working fine here so far. But I must admit that I haven't listened to a lot of music, yet. There still might be some special characters in song titles that are causing the script to fail. I will take a closer look at this over the weekend when I have more time on my hands.

Until then, it would be very helpful if you could run the AdKiller manually whenever you use Spotify and save the output to a text file whenever it fails. Please post the output here as soon as you've collected a few different cases. That way it will be easier to track the issue down.

As for the script not starting automatically: What happens if you execute the Wrapper manually? Does the AdKiller start after Spotify is launched (you could check by looking it up in your task manager. It should be listed as two subprocesses).

Feltzer commented 10 years ago

OK, I think I have found the problem:

The latest update of the script was failing to retrieve the track data from xprop when playback was paused. After the first ad was over it would pause the playback and then detect the paused track as an ad. This would go on until restarting the script.

If I'm not mistaken 1169369 should fix the issue. Please give it another try, @SecUpwN.

SecUpwN commented 10 years ago

Thanks for investing some more time to add additional fixes, @Feltzer! It seems that your latest fixed playback issues, but it still doesn't detect the Ad when beining in full screen mode and started via spotify-wrapper.sh. I still have to start up spotify-adkiller.sh manually to enable correct Ad detection. I would very much prefer if Spoty-AdKiller worked even when Spotify is started via the normal click on the Icon starting spotify-wrapper.sh and is also minimized.

Here's my own small thought about this: Spotify doesn't provide a native RPM-Installation file for openSUSE. Thus, I am using Spotify-Make to re-compile the *.deb which was meant for Ubuntu to be working on openSUSE (see linked GitHub to see which steps are taken). The outcome is a correctly installed Spotify and a starter script called my-spotify. I renamed that script to spotify and placed it into /usr/bin/ where our two scripts reside. Maybe some internal naming within the binary conflicts with our script? I mean my-spotify vs. spotify (although the file my-spotify has been renamed)?

This snipped is when I noticed an Ad is playing even though I started Spotify like it should through spotify-wrapper.sh. I then manually started spotify-adkiller.sh and then it suddenly worked...

SecUpwN@openSUSE:~> spotify-adkiller.sh
## Using cvlc for local playback ##
XPROP:    Spotify
DBUS:     Happy Up Here
PAUSED:   Yes
AD:       No
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Hyundai – Hyundai
DBUS:     Happy Up Here
PAUSED:   No
## INITIAL: Unmuting sink 0 ##
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Röyksopp – What Else Is There ?
DBUS:     What Else Is There ?
PAUSED:   No
AD:       No
--------------------------------------------------------------------------------------------------
Feltzer commented 10 years ago

@SecUpwN: The window state should theoretically have no effect on ad detection.

Just to be clear: the snippet you posted is from the manually started instance of the AdKiller, right?

I think it will be important to first determine if the issues lies with the AdKiller or the environment it's run in (Wrapper, and Spotify starter script). Here's how we might be able to track this down:

For your next Spotify sessions please start Spotify manually via the terminal instead of using the desktop launcher. As soon as Spotify is up and running open another terminal and manually run spotify-adkiller.sh. Then just go ahead and listen to your tracks as you normally would. If you see anything abnormal (ad not being detected, spotify staying muted, etc.) please post the complete AdKiller log here.

If everything works fine we can start examining the Wrapper and how it's set up on your system.

SecUpwN commented 10 years ago

Yes, the snippet above was from the manually started instance. I re-tested the way you suggested and killing Ads works well (except for that the Ad plays a tiny millisecond just before the local song starts). How shall I test spotify-wrapper.sh to be working properly now, @Feltzer?

EDIT: Spotify-AdKiller doesn't seem to grabb the Ad at times. Manually started spotify-adkiller.sh:

SecUpwN@openSUSE:~> spotify-adkiller.sh
## Using cvlc for local playback ##
XPROP:    Spotify
DBUS:     Follow Me
PAUSED:   Yes
AD:       No
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Samsung Electronics GmbH – Samsung Pro Kick
DBUS:     Follow Me
PAUSED:   No
## INITIAL: Unmuting sink 0 ##
--------------------------------------------------------------------------------------------------
XPROP:    Spotify
DBUS:     Follow Me
PAUSED:   Yes
AD:       No
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Samsung Electronics GmbH – Samsung Pro Kick
DBUS:     Follow Me
PAUSED:   No
AD:       Yes
## Muting sink 0 ##
## Switching to local playback ##
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Heincz Gábor 'Biga' – Easy Loving
DBUS:     Easy Loving
PAUSED:   No
AD:       No
## Pausing Spotify until local playback finished ##
--------------------------------------------------------------------------------------------------
XPROP:    Spotify
DBUS:     Easy Loving
PAUSED:   Yes
AD:       No
--------------------------------------------------------------------------------------------------
Feltzer commented 10 years ago
SecUpwN@openSUSE:~> spotify-adkiller.sh
## Using cvlc for local playback ##
XPROP:    Spotify
DBUS:     Follow Me
PAUSED:   Yes
AD:       No
--------------------------------------------------------------------------------------------------
XPROP:    Spotify - Samsung Electronics GmbH – Samsung Pro Kick
DBUS:     Follow Me
PAUSED:   No
## INITIAL: Unmuting sink 0 ##

Strange, this looks like Spotify played an ad right after launching, which I have never had happen before. I will need to know the exact circumstances under which you observed this issue:

SecUpwN commented 10 years ago

@Feltzer, the logfile indicates your assumption. But in fact, I just started Spotify using the recommended way through spotify-wrapper.sh. When I noticed that after a few songs an Ad played, I started spotify-adkiller.sh manually and recorded above logfile while the Ad was playing. Hence it seems like Spotify started right off with an Ad, which really didn't happen. But my point is: How come spotify-wrapper.sh doesn't do it's job as it is supposed to? Seems like Spotify runs without properly using spotify-adkiller.sh when I start it through the wrapper-script..

Feltzer commented 10 years ago

@SecUpwN :

OK, I see. Please do the following for me:

  1. Remove > /dev/null 2>&1 in line 51 and 64 of spotify-wrapper.sh
  2. Run spotify-wrapper.sh in a terminal
  3. Listen to a few songs until at least one ad comes on
  4. Post the terminal output here
Feltzer commented 10 years ago

@SecUpwN:

OK, I am pretty sure this should be fixed with ab1b0c34ef32299d9b9a69f63b18746893edecdd. It was a simple typo.

SecUpwN commented 10 years ago

Thanks for your commitment to this project, @Feltzer! I'll run a few tests tomorrow and will close this Issue if everything works as it should be. Again, your work is very much appreciated - keep it up! :+1: