Recently Added question

Artist radio, genre radio & related artists. A Subsonic server for music nerds.

Moderator: moderators

Recently Added question

Postby theeraser » Thu Dec 06, 2012 11:21 pm

Big fan of this mod, last.fm data integration is a tremendous catch. Unfortunately, I can't see myself making the switch from vanilla unless my recently added section keeps consistent with my actual music directory. I understand that any albums added going forward will display properly as recently added. But my current music library is not correctly listed in recently added. Any way it import the data from my backed up vanilla database? or to utilized windows date modified date?

Hopefully that made sense. Any help would be supremely appreciated!
theeraser
 
Posts: 9
Joined: Thu Dec 06, 2012 11:12 pm

Re: Recently Added question

Postby hakko » Fri Dec 07, 2012 7:19 am

Using file modification time for initially added albums was a good idea. I just ran this on my library, you could try it on your own risk. There is a tool called pgAdmin III that comes with the PostgreSQL installation, use it to connect to your local server and then to your musiccabinet database, and then run this in a SQL window (depending on the size of your library, it'll take a little while to finish).

Code: Select all
truncate library.album;

insert into library.album (album_id) select album_id from (select distinct album_id, max(modified) from library.filetag ft inner join library.file f on ft.file_id = f.id group by album_id order by max(modified)) a;

update library.album la
set album_name_search = array_to_string(array(select unnest(string_to_array(artist_name || ' ' || album_name, ' ')) order by 1), ' ')
from music.album malb
inner join music.artist mart on malb.artist_id = mart.id
where malb.id = la.album_id and la.album_name_search is null;

update library.album a set year = ft.year
from library.filetag ft where a.album_id = ft.album_id and ft.year is not null
and (a.year is null or a.year != ft.year);

update library.album a set embeddedcoverartfile_id = ft.file_id
from library.filetag ft where a.album_id = ft.album_id and ft.coverart
and a.embeddedcoverartfile_id is null;

update library.album a
set coverartfile_id = f.id
from library.file f
inner join (
select directory_id, min(priority) as priority from library.file f
inner join library.coverartfilename c on upper(f.filename) = upper(c.filename) group by directory_id
) mp on f.directory_id = mp.directory_id
inner join library.coverartfilename c on upper(f.filename) = upper(c.filename) and mp.priority = c.priority
inner join (
select distinct f.directory_id, ft.album_id from library.filetag ft
inner join library.file f on ft.file_id = f.id
) da on f.directory_id = da.directory_id
where da.album_id = a.album_id and a.coverartfile_id is null;
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden

Re: Recently Added question

Postby hakko » Sun Dec 09, 2012 11:19 am

This has been added in 0.7.16. viewtopic.php?f=4&t=9777&p=49943#p49943
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden

Re: Recently Added question

Postby theeraser » Mon Dec 10, 2012 11:16 pm

That's fantastic! Thank you so much.

It does seem to be grabbing the date modified off the individual songs. For example, if one song is modified a few months after the album is initially added to my library, it bumps the whole album to that more recent date.

My directory is setup as follows:
Music>Artist>Albums>Songs

Is it possible to take the date modified off the Album folder instead of the song files themselves.

My original assumption was if a song was modified, the folder it was contained in would reflect that date modified date. But it seems it doesn't change unless the majority of the files are modified. At least that is how it appears to be.

Once again I hope this makes sense.
theeraser
 
Posts: 9
Joined: Thu Dec 06, 2012 11:12 pm

Re: Recently Added question

Postby hakko » Tue Dec 11, 2012 6:01 am

I guess you could replace order by max(modified) with order by min(modified) to have albums sorted by earliest date instead of most recent. Folder modification times are not stored in PostgreSQL and I wouldn't trust them to be correct on all platforms.

If you're on a Linux/OSX platform, it should also be easy to run a script to set the file modification time to that of the containing album.
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden

Re: Recently Added question

Postby theeraser » Tue Dec 11, 2012 1:43 pm

Excellent, that worked like a charm. I truly appreciate your effort in helping me. Would it be possible for me to donate?
theeraser
 
Posts: 9
Joined: Thu Dec 06, 2012 11:12 pm

Re: Recently Added question

Postby hakko » Tue Dec 11, 2012 6:53 pm

Great! I don't have an account set up for this project, but if you'd like to donate any amount of money to charity as "from hakko", I'd really appreciate that.
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden

Re: Recently Added question

Postby theeraser » Thu Dec 13, 2012 12:04 am

I will do that!

Now, not to get off topic in this thread. But it seems my top artists aren't fetching properly from last.fm. I have over 50k plays on my last.fm, so it should be enough. It seems to be omitting certain artists regardless of the time frame selected. Any suggestions?

Perhaps on a related note, there is just one artist showing up on most played.

If you'd rather I slide this into a new thread let me know.
theeraser
 
Posts: 9
Joined: Thu Dec 06, 2012 11:12 pm

Re: Recently Added question

Postby hakko » Thu Dec 13, 2012 6:49 am

Thanks!

Yeah normally I prefer new threads with informative titles as it helps to re-use topics if people have the same problem or ask the same question.

But you can try this:

Code: Select all
elect lastfm_user, page, session_key is null, invocation_time from library.webservice_history h inner join music.lastfmuser u on h.lastfmuser_id = u.id where h.calltype_id = 7 order by lastfm_user, page;


Page is number of days (tre months, six months, twelve months, overall (-1)). session_key tells if you've identified correctly to last.fm. invocation_time is last time we received information from last.fm.
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden


Return to MusicCabinet

Who is online

Users browsing this forum: No registered users and 40 guests