Page 1 of 2

Default Artwork if No Other

Posted: Sun Aug 05, 2012 9:26 am
by 1Mouse
I'd like to be able to load images from my HD via a $ in a text file.

I thought RawGet so that it could check the text for $ and if $ exists the display corresponding image but if no image on HD then display default.

Am I on the right track? and if so can someone assist please?

Re: Default Artwork if No Other

Posted: Mon Aug 06, 2012 9:47 am
by Allanon
Hi 1mouse,
to be honest I don't understand what do you mean with $, maybe a placeholder for the file to display in an external file?

If so you could structure a text file with your picture file entries, and place a default picture somewhere:

Suppose that:
text file with your images full path is : mypictures.txt
you default picture is : mydefaultpicture.jpg

Code: Select all

; *** simple loop/idea could be: ***

Local fid = FileOpen(Nil, "myprictures.txt", #MODE_READ)

While Not(Eof(fid))
   Local picpath = ReadLine(fid)
   If Exists(picpath)
      ; ---- HERE YOU PLACE YOUR CODE TO LOAD AND DISPLAY THE PICTURE <PICPATH>
   Else
      ; ---- HERE YOU PLACE YOUR CODE TO DISPLAY THE DEFAULT PICTURE <mydefaultpicture.jpg>
   EndIf
Wend

CloseFile(fid)

This is just an idea so you have something you can start working on :)

Re: Default Artwork if No Other

Posted: Mon Aug 06, 2012 9:25 pm
by 1Mouse
I've tried code:
/*** Display Artwork**/
Local cover = OpenFile(Nil, album2$, #MODE_READ)
While Not(Eof(cover))
Local picpath = ReadLine(cover)
If Exists
LoadBrush(4, album2$)
ScaleBrush(4, 130, 130)
DisplayBrush(4, 10, 10)
Else
DisplayBrush(9, 10, 10)
EndIf
Wend
CloseFile(cover)


It opens a file when coverart is available however I'm still getting an error when it tries to open an MP3 that has no coverart.

Brush4 is the coverart and Brush9 is the default missing artwork image

I know for sure that there are no problems with the mp3s I'm using.

Re: Default Artwork if No Other

Posted: Mon Aug 06, 2012 9:57 pm
by Allanon
Hi 1Mouse,
I will help you, but you have to help me understand what you are trying to do because your code is not clear to me :)
Please explain how you have organized the project, for example, album2$ what's supposed to store? The cover art file or the cover art filename?
Talking about MP3s, in which way you connect music with cover art?

Re: Default Artwork if No Other

Posted: Mon Aug 06, 2012 10:09 pm
by 1Mouse
I've used the ID3.hws routine and the tag in the ID3 is TALB, I used:
CreateTextObject(7, artist$)
ElseIf tag$ = "TALB"
Seek(1, FilePos(1) + 1) ; skip encoding
album$ = ReadString(1, framelen - 1)
album2$ = album$

album$ (becomes TextObject) is used to display the album title in text form and album2$ (becomes Brush) is used for the coverart which is save on the HD

So when I load an mp3 it reads the ID3 tag and displays text which is album$ and displays coverart which is album2$ which all works, however if the coverart isn't in the same folder then I get an error: Cannot Read File

Re: Default Artwork if No Other

Posted: Thu Mar 09, 2017 11:02 pm
by 1Mouse
@all

I've advanced a little since 2012, however not as far as expected.

My Intune program now loads coverart when available and default artwork if none available, however I can't put the coverart in the same folder as the music it has to be in the root.

I get an error when the Mp3 ID3 tag has missing metadata, if the artist/album/track data is missing I get an error. If I load a track with all the data it plays fine and load a file with missing data that plays but on restart loading the file with missing data gives me an error.

Re: Default Artwork if No Other

Posted: Fri Mar 10, 2017 2:19 pm
by Juan Carlos
We have more examples like other languages this is the Hollywood problem, even I tryed to convert visual basic, javascrit and c but the language structure is very different and only with easy routines is possible, in my case I make different proyects to avoid stopped and leave this language, with beatyful examples but no useful to make normal apps.

Re: Default Artwork if No Other

Posted: Sat Mar 11, 2017 2:35 pm
by airsoftsoftwair
Keep in mind that the ID3.hws code from HollyAmp is a really, really rudimentary ID3 parser. It certainly doesn't handle all the intricacies of ID3 tags. This code needs a lot of improvement in order to be compatible with all ID3 features...

Re: Default Artwork if No Other

Posted: Sun Mar 12, 2017 2:37 pm
by 1Mouse
At present if there is missing ID3 metadata I get an error rather than my software displaying nothing

Re: Default Artwork if No Other

Posted: Wed Mar 15, 2017 12:28 am
by airsoftsoftwair
Maybe the ID3 recognizer isn't that stable... as I said, that code really implements just a rudimentary parser...