IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Play count shared by same song on differnt albums?
firewater
post Aug 31 2015, 23:32
Post #1





Group: Members
Posts: 36
Joined: 25-November 13
Member No.: 112526



Is there any complement that allows for the play count to be updated in more than one instance of a song if it's found repeated in another album by the same artist (and having the same title)? For example if I listen to The Smiths - Panic from the album Rank, that the play count updates both that and The Smiths - Panic from the album The World Won't Listen? I'm currently using a script that fetches play count from last.fm and it does this, but I'm tired of the site so I wanna do the switch to offline play count and I don't want to lose this feature...
Go to the top of the page
+Quote Post
marc2003
post Aug 31 2015, 23:52
Post #2





Group: Members
Posts: 5601
Joined: 27-January 05
Member No.: 19379



you could modify the WSH script so it bypasses last.fm and increments the play count by itself.

first you need to go to file>preferences>tools>custom database.
click on the action tab.
click add and then use the following settings:

Display: Customdb Add 1
Field: LASTFM_PLAYCOUNT_DB
Update: Contextmenu
Value: $add(1,$if2(%LASTFM_PLAYCOUNT_DB%,0))

now restart foobar before doing anything else.

now right click the WSH panel, find where it says..

CODE
function on_playback_time() {
    ps.playback_time();
}


replace it with

CODE
function on_playback_time() {
    ps.elapsed_time++;
    if (ps.elapsed_time == ps.target_time)
        fb.RunContextCommandWithMetadb("Customdb Add 1", p.metadb, 8);
}


now you're updating the playcount locally, there are no longer restrictions on the length of song or how much of it needs to be played before counting. if you want to change that, you go back in to the panel and find this...

CODE
function on_playback_new_track() {
    ps.playback_new_track();
}


replace it with

CODE
function on_playback_new_track() {
    ps.time_elapsed = 0; //do not edit this
    ps.target_time = Math.min(Math.floor(fb.PlaybackLength / 2), 240); //just edit this.
}


currently the target time is half the length or 4 minutes if the track is longer than 8 minutes. but now you're free to edit that however you like. just in case it isn't clear, the time must be specified in seconds.

This post has been edited by marc2003: Sep 1 2015, 00:05
Go to the top of the page
+Quote Post
firewater
post Sep 2 2015, 04:33
Post #3





Group: Members
Posts: 36
Joined: 25-November 13
Member No.: 112526



Thank you very much for the detailed explanation and for still supporting your scripts!! I'm having trouble with this though, and I'm pretty sure I followed the steps properly:



Then I close foobar and...



As soon as I update function on_playback_time() { with the code you provided it stops working, and there is not even a message on the console regarding the play count script at all.

One more thing the code originally said:

CODE
function on_playback_time() {
//do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
ps.cross_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\cross.png");

    ps.playback_time();
}


so I moved

CODE
//do not use fb.FoobarPath here as fb.ProfilePath already points to the same location if using portable mode
ps.cross_img = gdi.Image(fb.ProfilePath + "my_theme\\images\\cross.png");


to another part of the script for it to be like you wrote it. I tried merging it with the updated code too, but none of these sorting methods had any effect on the play count working or not (well the line seems to be merely about an image anyway). Resulting script: http://pastebin.com/Su6pNUpa

Also wondering, in case this works will it consider tracks shorter than 30 seconds? and is there a way to make it tag the files? I searched for a way to do this and I tried the one in which you import settings with "Format from other fields..." but I think it imports the data held at that specific time, and doesn't update after that. I made sure they play count displayed is %LASTFM_PLAYCOUNT_DB% and not the $PLAY COUNT$ tag I generated with this method by the way so it's not that either...


Thanks again.

This post has been edited by firewater: Sep 2 2015, 04:58
Go to the top of the page
+Quote Post
marc2003
post Sep 2 2015, 06:55
Post #4





Group: Members
Posts: 5601
Joined: 27-January 05
Member No.: 19379



ah, it was a silly typo...

CODE
ps.time_elapsed = 0; //do not edit this


should have been

CODE
ps.elapsed_time = 0;


also, the bit that sets the image does not go inside the on_playback_time function.

http://pastebin.com/z0VgsaVH

it is possible to tag files with WSH panel mod but you realise it would only increment the playcount for that file and it wouldn't be shared across all files with the same artist/title tags in your collection? this is the opposite of what you asked for...
Go to the top of the page
+Quote Post
firewater
post Yesterday, 05:18
Post #5





Group: Members
Posts: 36
Joined: 25-November 13
Member No.: 112526



thanks more or less works now! the script crashes with short tracks though.

and i didnt know it would only choose one of the files, so im better off with a database. do you know if there is a simple way to "mark" played files though? the idea is that it's modified once played so i can sort it on windows by most recently modified, so i can know the most recent songs i've listened to. foobar/my pc has crashed many times and more often than not when it did i had many cached scrobbles that i lost, so then i have to guess what songs i listened to that day and manually scrobble them. this is one of the reasons why i wanted it local so that the playcounts are legit and not a guess (unless the crash will affect the database too?). maybe if i make it tag them as playcount just to mark them but display the database numbers for the actual playcount?

This post has been edited by firewater: Yesterday, 05:51
Go to the top of the page
+Quote Post
marc2003
post Yesterday, 13:26
Post #6





Group: Members
Posts: 5601
Joined: 27-January 05
Member No.: 19379



i can't see any reason why it would crash on short tracks. if you reported the error from the console it would help.... FWIW, the shortest track i have is 9 seconds and that worked fine.

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 4th September 2015 - 02:55