Author Topic: Now Playing to External Files  (Read 114524 times)

mrad

  • Guest
Only album artworks, no artist pictures are found in Internet. That's why artist picture is zero byte.
Ok, let us start over. Looking at the screenshot that I sent -- shows two individual artwork sources (the green arrows). Those two artworks are already on my computer.  The question was, does the MB API allow you to output those two localised images ?
  • If there is a Primary Artwork {via right click any track > edit > artwork > primary picture}, then output it
  • If the Now Playing artwork {via Preferences > Layout (1) > Configure Views (button) > Playing Track (tab) > artist photos} changes (it can change multiple times during every track with certain settings), then output it.


Note: I have always observed MB displaying two images (green arrows) exactly as the second screenshot shows.
I guess we need to find out exactly what "Library_GetArtistPicture_Managed" and "Library_GetArtistPictureUrls" represent.
--
As for zero byte album artwork, could you try this plugin version? Post content of "C:\Windows\Temp\NP_Log.txt" when album artwork is zero size.
Sorry to report that "C:\Windows\Temp\NP_Log.txt" is 0 bytes
Last Edit: September 01, 2013, 04:05:50 PM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595
"C:\Windows\Temp\NP_Log.txt" is 0 bytes
This means that writing to this file is not finished. Was statusbar text "Writing tags to file..." already disappeared when you took a look at "NP_Log.txt"?

lyrics ;)
I remember :)

boroda

  • Sr. Member
  • ****
  • Posts: 4595
Here is new version of plugin. Now writes tag info if "resume playback on startup" is enabled and writes lyrics to predefined file.

mrad

  • Guest
NP Test Report

Now writes tag info if "resume playback on startup"
Yes, this addresses the issue found, thank you.

writes lyrics to predefined file
Image) Red box UI lyrics area is not saved to "Lyrics file:", instead the file content is 3 hex bytes > $EF $BB $BF

Image 1) Successfully saved as content of "Artist picture:" (266 KB see Image 4)

Image 2) Track primary picture is not saved to "Artwork file:" (0 KB see Image 4) - fixed ;)

Was statusbar text "Writing tags to file..." already disappeared when you took a look at "NP_Log.txt"?
Image 3) Sorry, I dont know how to enable a traditional explorer style statusbar text. However, see new content of "NP_Log.txt" below the image

Image 4) Explorer view of NP files related to the current played track



At the time of the playing the track in the above image (0:52/4:51) ...

Content of NP_Log.txt
Code
null

Content of NowPlayingToTextFile.PropNamesErrorLog.txt
Code
Adding URL / Url
Adding Kind / Kind
Adding Format / Format
Adding Size / Size
Adding Channels / Channels
Adding Sample Rate / SampleRate
Adding Bitrate / Bitrate
Adding Date Modified / DateModified
Adding Date Added / DateAdded
Adding Last Played / LastPlayed
Adding Play Count / PlayCount
Adding Skip Count / SkipCount
Adding Time / Duration
Adding Track Gain / ReplayGainTrack
Adding Album Gain / ReplayGainAlbum

Content of NowPlayingToTextFile.TagNamesErrorLog.txt
Code
Adding <Not used> / -120
Adding Title / TrackTitle
Adding Album / Album
Adding Album Artist (displayed) / AlbumArtist
Adding Album Artist / AlbumArtistRaw
Adding Artist (displayed) / -1
Adding Artist / -2
Adding BPM / BeatsPerMin
Adding Composer (displayed) / -3
Adding Composer / -4
Adding Comment / Comment
Adding Conductor / Conductor
Adding Disc# / DiscNo
Adding Disc Count / DiscCount
Adding Encoder / Encoder
Adding Genre / Genre
Adding Genre Category / GenreCategory
Adding Grouping / Grouping
Adding Keywords / Keywords
Adding Lyricist / Lyricist
Adding Mood / Mood
Adding Occasion / Occasion
Adding Origin / Origin
Adding Publisher / Publisher
Adding Quality / Quality
Adding Rating / Rating
Adding Album Rating / RatingAlbum
Adding Love / RatingLove
Adding Tempo / Tempo
Adding Track# / TrackNo
Adding Track Count / TrackCount
Adding Year / Year
Adding Lyrics? / HasLyrics
Adding Virtual1 / Virtual1
Adding Virtual2 / Virtual2
Adding Virtual3 / Virtual3
Adding Virtual4 / Virtual4
Adding Virtual5 / Virtual5
Adding Virtual6 / Virtual6
Adding Virtual7 / Virtual7
Adding Virtual8 / Virtual8
Adding Virtual9 / Virtual9
Adding Virtual10 / Virtual10
Adding Virtual11 / Virtual11
Adding Virtual12 / Virtual12
Adding Virtual13 / Virtual13
Adding Virtual14 / Virtual14
Adding Virtual15 / Virtual15
Adding Virtual16 / Virtual16
Adding Sort Artist / Custom1
Adding Sort Album Artist / Custom2
Adding Custom3 / Custom3
Adding Custom4 / Custom4
Adding Custom5 / Custom5
Adding Custom6 / Custom6
Adding Custom7 / Custom7
Adding Custom8 / Custom8
Adding Custom9 / Custom9
Adding Custom10 / Custom10
Adding Custom11 / Custom11
Adding Custom12 / Custom12
Adding Custom13 / Custom13
Adding Custom14 / Custom14
Adding Custom15 / Custom15
Adding Custom16 / Custom16
Last Edit: September 01, 2013, 04:03:05 PM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595
The only possible reason for not exporting artwork/lyrics I have in mind is that you don't have embedded/linked artworks and lyrics, they simply are dynamically downloaded from Internet (there is no way to get cached album artwork/lyrics in API at this moment).

Try this version.
Last Edit: August 30, 2013, 09:27:37 PM by boroda74

mrad

  • Guest
NP Test Report  --  Looking really good !

100% Success... track primary picture IS saved to "Artwork file:" What is particularly cool about this artwork feature is that all artworks are saved as the one name and file type - a genius solution in simplification. Far better than I originally asked for.  ;D

------------

99% Lyrics are saved, sometimes there are not, perhaps partly due to a race condition, but there may also be an issue with the lyricsReloaded plugin ... i'm not sure until potential races are resolved.

I observed the following, I played a track that displayed lyric, the lyric has been in the MB InternalCache since 19/8/2013. Yet the NP lyric file was 0KB - strange. And this happened after a previous track from the same album output to the lyrics file with no problem. Also, in another case, I watched MB fetch the lyrics and then clicked again on the track -- the result was correct output - race on.

So for the race condition, I suggest a TP timer loop. Actually, this can be used for two purposes, here is an example you can code up...
Code
timerLoop()
if remainingPlaytime is greater than 5 seconds
// 1. Handle lyrics. Fetching from internet can take time
if exists(currentTrack -> lyrics)
savefile(prefs -> lyricsFilename)
endif

// 2. handle rotating artist pictures (e.g. flickr, future proofing a future art plugin or a MB upgrade)
chksum = md5(artistPicture)
if last_chksum is not equal to chksum
last_chksum = chksum // new picture found
savefile(prefs -> artistPicture)
endif
endif
end_timerLoop

NP_main()
...
set last_chksum = null
call timerLoop every 2 seconds
...
end_NP_main

Ideally, MB would have a "Lyrics ready" call-back, but a timer loop test will do if/until then.
------------

Currently, if MB does not download a hi res image, then "Artwork picture:" will be 0KB.  Perhaps delete this file so a 3rd party scripts can issue an...
Code
IF EXIST "%artworkPicture%"
which would be far easier than trying to determine a 0 byte filesize from a scripting perspective. Naturally, all output files would be handled in the same manner as described here.

------------

Thanks again :D
Last Edit: August 31, 2013, 04:21:42 AM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595

boroda

  • Sr. Member
  • ****
  • Posts: 4595
@mrad
Still no support for rotating artist pictures. Don't know how to do it, maybe its impossible with current MB API.

mrad

  • Guest
First, awesomeness - and high fives.
It's really great watching the old files disappear and new ones created with content when the data arrives in realtime  ;D
On another note, I played a track where the Artist_Picture file had a "date taken" tag of 2007 - that is cool metadata!

@mrad
Still no support for rotating artist pictures. Don't know how to do it, maybe its impossible with current MB API.
I'm not surprised, I think the first fetch is saved as a static img in the \AppData\InternalCache\\ArtistBackdrops folder.

So the two image API calls currently used by NP are...
(1) "Library_GetArtistPicture_Managed" = Track Primary Artwork
(2) "Library_GetArtistPictureUrls" = Now Playing Artwork (once time fetch fan art?)

perhaps I need to wishlist...
"Library_GetRotatePictureUrls"

but first, can I just confirm that the above (2) only ever contains ONE hi res image even over playtrack time (its plural name suggests otherwise).

as always, thank you.

ps. I saw the base64 substitution for md5 ;)
Last Edit: August 31, 2013, 03:30:50 PM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595
So the two image API calls currently used by NP are...
(1) "Library_GetArtistPicture_Managed" = Track Primary Artwork
(2) "Library_GetArtistPictureUrls" = Now Playing Artwork (once time fetch fan art?)
Not at all. NP is using NowPlaying_GetArtwork() for retrieving artworks (it also returns cached artwork if there is no embedded one) and NowPlaying_GetArtistPicture() for retrieving artist picture (cached one).

EDIT: There is a way to get all already cached artist pictures, but picture rotation cant be synced with rotating pictures displayed by MB.

perhaps I need to wishlist...
I'll give you +1 :)

ps. I saw the base64 substitution for md5 ;)
Its more reliable ;) Actually just didn't want to investigate how to use md5.
Last Edit: August 31, 2013, 08:18:00 PM by boroda74

mrad

  • Guest
[ Wishlist item created ] :)

---

"Library_GetArtistPictureUrls"
can we confirm that this call only ever contains ONE hi res image over the playtrack duration (its plural name suggests otherwise)
I think Steven added some goodness into this call that is not yet fully exploited.
Last Edit: September 01, 2013, 05:02:47 PM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595
Steven, is there any way of getting currently displayed rotating artist picture? NowPlaying_GetArtistPicture() returns only 1st artist picture from rotating ones.
use NowPlaying_GetArtistPictureUrls(true, urls[]) to get them all the locally stored ones but there is no way to get the current active one

mrad

  • Guest
use NowPlaying_GetArtistPictureUrls(true, urls[]) to get them all the locally stored ones but there is no way to get the current active one

ahh, so, the above comment couples very nicely with my first wishlist item. To recall...

1) Suggestion, all artworks currently being used should be added as a field to output ;-)
the additional NP provided setting would something like "Artist Picture Path:"  Therefore, if slow systems cannot handle it, this field can be left blank and the existing fields can still provide at least the one image that they do currently.

:D
Last Edit: September 02, 2013, 06:11:17 PM by mrad

boroda

  • Sr. Member
  • ****
  • Posts: 4595
ahh, so, the above comment couples very nicely with my first wishlist item. To recall...

the additional NP provided setting would something like "Artist Picture Path:"  Therefore, if slow systems cannot handle it, this field can be left blank and the existing fields can still provide at least the one image that they do currently.
Yes, but as I wrote: picture rotation cant be synced with rotating pictures displayed by MB. Of course I can organize own picture rotation if this is what you would want. Or maybe you meant exporting all artist picture paths at ones to separate text file?
Last Edit: September 02, 2013, 07:42:23 PM by boroda74

mrad

  • Guest
ahh, so, the above comment couples very nicely with my first wishlist item. To recall...

the additional NP provided setting would something like "Artist Picture Path:"  Therefore, if slow systems cannot handle it, this field can be left blank and the existing fields can still provide at least the one image that they do currently.
Yes, but as I wrote: picture rotation cant be synced with rotating pictures displayed by MB. Of course I can organize own picture rotation if this is what you would want.
Yeah, I totally understand that we can't sync until/if @Steve is able to add that feature.
No rotation needed, and is outside the scope of the plugin imho.

Or maybe you meant exporting all artist picture paths at ones to separate text file?
Yes, I think the easiest step forward is to export all artist picture paths to a separate text file. It will be interesting to see the results.

Thank you :)
Last Edit: September 03, 2013, 03:45:32 AM by mrad