• Home
  • Blog
  • Add-ons
  • Forum
  • Wiki
  • Developers
Nightingale - The tune of life, the tune of yours
  • Portal
  • Search
  • Member List
  • Calendar
  • Help
  • Portal
  • Search
  • Member List
  • Calendar
  • Help
Guest Hi, Guest
  • Login
  • Register
Login
Username:
Password: Lost Password?
 
Nightingale Forums Development Technical Development Album Art

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Album Art
SteveW Offline
Junior Member
**
Posts: 45
Threads: 9
Joined: Jul 2012
Reputation: 2
#1
09-10-2012, 09:12 PM
Hi all
I'm playing around with an add-on and want to do a check to see if Album Art exists in the application. The file might be harder??

Can someone please tell me what property is used to display it in an addon. I've searched through a few that display album art but can't seem to locate it??

It should be something like SBproperties.****************
SteveW
Find
Reply
ilikenwf Offline
Developer/Project Manager
*******
Posts: 412
Threads: 22
Joined: Nov 2010
Reputation: 8
#2
09-11-2012, 02:10 AM
GeekShadow is your man for this question, most likely...he's in IRC right now - #nightingale on irc.mozilla.org
How to Build Nightingale | Nightingale on GitHub
Find
Reply
freaktechnik Offline
CCO (Chief Crashing Officer)
*******
Posts: 498
Threads: 24
Joined: Sep 2010
Reputation: 11
#3
09-12-2012, 03:09 AM
Its SBproperties.primaryImageURL and it returns a file:/// URL

Here a little check to see if the file exists (I didn't write this code on my own):
Code:
/**
* aMediaItem : The media item the album art should be checked on existence
* mAlbumArtUrl : the URL of the album art picture
*/
if (aMediaItem) mAlbumArtUrl = aMediaItem.getProperty(SBProperties.primaryImageURL);
    
    try{
      var ios = Components.classes["@mozilla.org/network/io-service;1"].
            getService(Components.interfaces.nsIIOService);
      var fileurl = ios.newURI(mAlbumArtUrl, null, null);
      fileurl instanceof Components.interfaces.nsIFileURL;
      if (fileurl instanceof Components.interfaces.nsIFileURL && !fileurl.file.exists())
        mAlbumArtUrl = null;
    }catch(e){
      
    }
freaktechnik
Website Find
Reply
rsjtdrjgfuzkfg Offline
Developer
*******
Posts: 664
Threads: 15
Joined: Oct 2011
Reputation: 15
#4
09-15-2012, 09:20 PM
(09-12-2012, 03:09 AM)freaktechnik Wrote: Its SBproperties.primaryImageURL and it returns a file:/// URL

If you need the file path itself, getting the path via resolving the URL is required, at least on Windows I remember that there were resource:// urls instead of file:// urls sometimes, which cannot be parsed directly.
Songbird/Nightingale Community Developer and German Translator
Find
Reply
SteveW Offline
Junior Member
**
Posts: 45
Threads: 9
Joined: Jul 2012
Reputation: 2
#5
09-17-2012, 05:48 PM
(09-15-2012, 09:20 PM)rsjtdrjgfuzkfg Wrote:
(09-12-2012, 03:09 AM)freaktechnik Wrote: Its SBproperties.primaryImageURL and it returns a file:/// URL

If you need the file path itself, getting the path via resolving the URL is required, at least on Windows I remember that there were resource:// urls instead of file:// urls sometimes, which cannot be parsed directly.

Yeah something seems a bit screwed up with where one should find things.

I know that the Album Art can reside in the source file and in NG, probably as a link to a file somewhere too. I suspect that the best one to use is the one from NG as it's probably quicker (my tunes are stored on an external drive) which is why I thought that there may be a simple property that you could determine was null or not as the case may be. Seems a bit harder than that though. I'll have a go with what I originally intended when I get some time.
SteveW
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)
  • Return to Top
  • Lite (Archive) Mode
  • RSS Syndication
Current time: 03-25-2023, 06:10 PM Powered By MyBB, © 2002-2023 MyBB Group.
Design By AliReza_Tofighi In WhiteCrow Software Group.
white outlined nightingale project logo

Nightingale is free!
It is an Open Source project released under the terms of the GNU General Public License v2 (GPL v2).
For more details, please read the license information.

Follow us!
f  g  t

Support
  • Community Forum
  • Official Blog
  • Add-ons
  • Wiki
  • Help Forum
Contribute
  • Developer's Center
  • Translate Nightingale
  • Source Code
  • Report a Bug
Ressources
  • Download Nightingale
Linear Mode
Threaded Mode