Plex music - recently played music - sorted alphabetically by artist?!? - itunes import problem

(I haven’t checked any other clients, so unsure if ios specific)

IOS app > Music > recently played music > shows alphabetical artist list ?!?!

ok first, it says recently played music, not recently artists, it should show tracks (not artists).

second, logically it should be sorted by recently played, not alphabetically.

In summary, it should simply work like recently played movies/shows, not this weird-■■■■ alphabetical artist list.

Which version of Plex for iOS do you have installed?
I have 5.5.1 installed and you’re right it’s grouping the recently played music by artist – however for me it’s actually sorting them by which song was last played

I have PlexAmp playing a library radio… so it’s a little random :wink:
Nirvana > Wir sind Helden > Norah Jones > Foo Fighters > Plain White T's > Coldplay > Linkin Park > Led Zeppelin > ... (not alphabetically)

not sure where version is, but it says build 15289, settings > help & support

version 5.5.1 according to ios app store/updates.

Not in recently played order.

Clipboard01

I wonder if my played table is screwed up in the database.

If I click on the recently played music, it goes to the full list, of (apparently) alphabetical artists.

do you get the same result when looking at your recently played music in other clients – e.g. Plex Web?

Hah I was just checking that…

apparently I have a large portion of my collection played some point in the future…

you sure this is correct?
the screenshot was taken pretty much at the middle of a list of ~220k tracks and everything above has played “a few seconds ago”?

Yes. I added the date played column, sorted, and scrolled to the point where my actual recently played tracks started.

Everything above is showing ‘a few seconds ago’ and appears to be in alphabetical (or close enough) order.

I obviously did not verify every track in alphabetical, but that would make sense, if all of those tracks are ‘before now’, I would assume plex’s (or the db itself) secondary sort would be alpha.

Not sure if plex imported bad play data (perhaps itunes playlist?) or interpreted the playdata incorrectly.

If I scroll down the bottom, the oldest play date is 19 years, and I have a handful of unplayed tracks (which appear to be stuff more recently added but not played).

I am pretty sure I haven’t been using Plex for 19 years, although my audio library is most certainly older than that.

no… not so much :wink:

ok more;

music > filtered > tracks > tracks last played > is after > 2018-10-13

117976 > a few seconds ago

which makes zero sense, because is after should show all recently played tracks, but is instead showing all before tracks.

At least it’s in line with your screenshot which claims that ~50% of your files have been played a few seconds ago. Do you have any plugins that interfere this way?

Not that I know of.

The only thing I can think of, is the aforementioned itunes import gone wrong.

well, I figured out the why, and where;

last_viewed_at field for the applicable items are set for the year 2036

Other than the previously mentioned guess, I don’t know how those files got dated like that.

Now I just have to clear those files last_viewed_at date.

That should resolve my second point in the top post.

That leaves my first point, if only plex would display the recently played TRACKS (instead of ARTISTS), I could be happy, at least temporarily.

for future reference, the following sql worked for me (no more future played tracks), recently played tracks appears to show the correct recently played artists.

UPDATE "main"."metadata_item_settings" SET "last_viewed_at"=? WHERE "guid" LIKE '%track%' ESCAPE '\' AND "last_viewed_at" LIKE '%2036%' ESCAPE '\';

also, I previously mentioned

I understand how it works now, ‘is after’ is later in time from the entered date, so obviously ‘is after’ today’s date is the future, not the past I initially expected.

to be fair… you have a massive amount of songs in this library. in particular if you recently added lots of them, this can impact the sqlite3 database Plex is relying on. There’s reports of same-sized libraries who’s owners end up repairing the database every other day to keep it working.

sure. the plex db is over 1.1 gig.

but it would be better if plex moved off of sqlite anyway though, especially as something that is ‘server’ based and supports multiple simultaneous users.

yes yes I know all the reasons for using sqlite, that still does not make it the best choice.

prior to plex, mediamonkey was my main music library/player, and with its sqlite db came issues. But the best thing about MM was its open API and scripting capabilities, I wrote a handful of public and private scripts for MM that filled in the spaces where I needed different or better functionality.

Hello.

I have determined how ‘in the future’ last played dates are being introduced.

it is from itunes playlist import.

While attempting to resolve this issue previously, I noticed I had database malformed or corrupted errors (which ended up being the gracenote cache databases).

After sorting out the gracenote db issues, I decided to start fresh with a new music premium database (same as old), and fresh rescan of ~200+k tracks.

While the actual import/rescan of the entire music folder is taking far too long to complete in one go, I have made 50% progress and verified that I had no played tracks from the future.

I decided to try to importing itunes xml to restore my ratings/playlists/import dates, etc.

After getting an itunes import on the existing scanned files, I now have a bunch of files that are now ‘last played’ in the future again.

example;

Here is a plex xml for one track played in the future

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="11" librarySectionTitle="Music" librarySectionUUID="4542ec05-caf3-4b56-9a95-c3de2b06396c" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1539019897">
<Track ratingKey="424629" key="/library/metadata/424629" parentRatingKey="424616" grandparentRatingKey="424447" guid="com.plexapp.agents.plexmusic://gracenote/track/7483349-39E12F5B5AADA3D56CCA3D7E8EE51364/7483362-46465EA1BC03D45683DF007382E0EED7?lang=en" librarySectionTitle="Music" librarySectionID="11" librarySectionKey="/library/sections/11" type="track" title="21st Century (Digital Boy)" grandparentKey="/library/metadata/424447" parentKey="/library/metadata/424616" grandparentTitle="Bad Religion" parentTitle="Against the Grain" originalTitle="Bad Religion" summary="" index="13" parentIndex="1" userRating="5.0" lastViewedAt="2085805696" thumb="/library/metadata/424616/thumb/1540105081" parentThumb="/library/metadata/424616/thumb/1540105081" grandparentThumb="/library/metadata/424447/thumb/1540105016" duration="168777" addedAt="1198860682">
<Media id="486067" duration="168777" bitrate="130" audioChannels="2" audioCodec="mp3" container="mp3">
<Part accessible="1" exists="1" id="494486" key="/library/parts/494486/1231926292/file.mp3" duration="168777" file="/data/media/audio/MP3/B/Bad Religion/1990 - Against the Grain [MP3]/13 - Bad Religion - 21st Century (Digital Boy).mp3" size="2748416" container="mp3" hasThumbnail="1">
<Stream id="862727" streamType="2" selected="1" codec="mp3" index="0" channels="2" bitrate="128" audioChannelLayout="stereo" samplingRate="44100" displayTitle="Unknown (MP3 Stereo)"/>
</Part>
</Media>
<Extras size="0"> </Extras>
</Track>
</MediaContainer>

here is the same track in itunes xml, with the play date in the past.

        <key>39283</key>
        <dict>   
            <key>Track ID</key><integer>39283</integer>
            <key>Name</key><string>21st Century (Digital Boy)</string>
            <key>Artist</key><string>Bad Religion</string>
            <key>Album Artist</key><string>Bad Religion</string>
            <key>Album</key><string>Against the Grain</string>
            <key>Kind</key><string>MPEG audio file</string>
            <key>Size</key><integer>2748416</integer>
            <key>Genre</key><string>Punk</string>
            <key>Total Time</key><integer>168803</integer>
            <key>Track Number</key><integer>13</integer>
            <key>Rating</key><integer>50</integer>
            <key>Year</key><integer>1990</integer>
            <key>Date Modified</key><date>2009-01-14T03:44:52</date>
            <key>Date Added</key><date>2007-12-28T16:51:22</date>
            <key>Play Date UTC</key><date>1899-12-30T00:00:00</date>
            <key>Bit Rate</key><integer>128</integer>
            <key>Sample Rate</key><integer>44100</integer>
            <key>Track Type</key><string>File</string>
            <key>File Folder Count</key><integer>-1</integer>
            <key>Library Folder Count</key><integer>-1</integer>
            <key>BPM</key><string>134</string>
            <key>Location</key><string>file://localhost/data/media/audio/MP3/B/Bad%20Religion/1990%20-%20Against%20the%20Grain%20%5BMP3%5D/13%20-%20Bad%20Religion%20-%2021st%20Century%20(Digital%20Boy).mp3</string>
        </dict>

Additional info;
this itunes xml was exported from mediamonkey with a script.

this particular track had not been played.

I don’t know why the played date is in the past in this exported xml, nor why plex interprets/imports it as played in the future.

both are wrong.

here is an xml from itunes itself with this track just added and unplayed

		<key>7035</key>
		<dict>
			<key>Track ID</key><integer>7035</integer>
			<key>Size</key><integer>2748416</integer>
			<key>Total Time</key><integer>168803</integer>
			<key>Track Number</key><integer>13</integer>
			<key>Track Count</key><integer>17</integer>
			<key>Year</key><integer>1990</integer>
			<key>BPM</key><integer>134</integer>
			<key>Date Modified</key><date>2009-01-14T09:44:52Z</date>
			<key>Date Added</key><date>2018-10-22T02:16:03Z</date>
			<key>Bit Rate</key><integer>128</integer>
			<key>Sample Rate</key><integer>44100</integer>
			<key>Artwork Count</key><integer>1</integer>
			<key>Persistent ID</key><string>DD6E628FAB056EA5</string>
			<key>Track Type</key><string>File</string>
			<key>File Folder Count</key><integer>-1</integer>
			<key>Library Folder Count</key><integer>-1</integer>
			<key>Name</key><string>21st Century (Digital Boy)</string>
			<key>Artist</key><string>Bad Religion</string>
			<key>Album Artist</key><string>Bad Religion</string>
			<key>Album</key><string>Against the Grain</string>
			<key>Genre</key><string>Punk</string>
			<key>Kind</key><string>MPEG audio file</string>
			<key>Sort Artist</key><string>Bad Religion</string>
			<key>Location</key><string>file://localhost//sauron/media/audio/MP3/B/Bad%20Religion/1990%20-%20Against%20the%20Grain%20%5BMP3%5D/13%20-%20Bad%20Religion%20-%2021st%20Century%20(Digital%20Boy).mp3</string>
		</dict>

itunes apparently does not even include the played date until something is played.

TLDR;

in summary, there are 2 bugs. 1 from the xml generator, and 1 for plex itunes xml importer.

itunes xml is generated by 3rd party with invalid played date data in the past. 1899-12-30T00:00:00
itunes xml is imported by plex, which inverts the invalid play date data to the future. 2085805696

insert back to the future jokes here.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.