Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#87005 - 12/04/2002 04:04 Hijack wish - configurable http download naming
pgrzelak
carpal tunnel

Registered: 15/08/2000
Posts: 4859
Loc: New Jersey, USA
Greetings!

A wish for hijack. Right now, http downloads are, by default, saved in the format of "artist - title.mp3". This is based on the code in combine_artist_title in the hijack patches. It would be great if this could be made configurable based on selected fields or a config.ini setting. This way, you could adjust the default naming structure without recompiling. (Like "artist - source - trackno - title.mp3" for example.)
_________________________
Paul Grzelak
200GB with 48MB RAM, Illuminated Buttons and Digital Outputs

Top
#87006 - 12/04/2002 08:06 Re: Hijack wish - configurable http download naming [Re: pgrzelak]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
Or you could just use Jemplode for that task.
_________________________
Tony Fabris

Top
#87007 - 12/04/2002 08:24 Re: Hijack wish - configurable http download naming [Re: tfabris]
pgrzelak
carpal tunnel

Registered: 15/08/2000
Posts: 4859
Loc: New Jersey, USA
Greetings!

Actually, I already use emplode or jemplode when I copy stuff down for myself.

I have put together a chopped up version of a minimal xsl/xml interface (based very loosely on charcoalgray's excellent web interface) for other people to use in the office. When I was doing this through displayserver 2b2, the code that handled the filenames was in javascript, so I was able to modify it easily.

I think the routine Mark wrote can be made generic to assemble the filenames based on a configuration setting instead of being hard coded. I personally like to save files in a format of "artist - album - track# - title", to make it easier to group and order the tracks.
_________________________
Paul Grzelak
200GB with 48MB RAM, Illuminated Buttons and Digital Outputs

Top
#87008 - 13/04/2002 08:54 Re: Hijack wish - configurable http download naming [Re: pgrzelak]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14484
Loc: Canada
Hi Paul!

I'll accept a patch for this if anyone wants to do a nice job of pulling it together.

Hijack work here is completely stalled (except for bug fixes) until about June or so, due to a high priority kernel contract I just picked up. Really fun and challenging work, I'll be heartbroken when it finishes, but.. then there's always Hijack waiting for me at the end.

Cheers


Top
#87009 - 13/04/2002 11:55 Re: Hijack wish - configurable http download naming [Re: mlord]
pgrzelak
carpal tunnel

Registered: 15/08/2000
Posts: 4859
Loc: New Jersey, USA
Greetings!

Not a problem. I will see what I can come up with, but I do not have a cross compiling environment to test it. It sounds like you have a nice project going! Enjoy!!!
_________________________
Paul Grzelak
200GB with 48MB RAM, Illuminated Buttons and Digital Outputs

Top
#87010 - 21/04/2002 18:39 Re: Hijack wish - configurable http download naming [Re: pgrzelak]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
I had a crack last night and have this basically finished now. The format string will go in the config.ini section in the form of something like:

%a - %n - %t (%y)

Would give:
Joe Satriani - 3 - Surfing With The Alien (1987)

At the moment there is only support for
track number (not zero padded)
title
album
year
artist

Anything others that people want?

The track number is a problem. ID3v2 supports more than two characters and some rippers (like CDex) put the track number as 1/11, 2/11 upto 11/11 in the v2 tag and simply 1, 2 .. 11 in the V1 tag.

Comments?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87011 - 21/04/2002 19:16 Re: Hijack wish - configurable http download naming [Re: Shonky]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
I like the way Jemplode handles it. Allows you to pad it to any number of digits in the specifier. Note that you should offer the option of either playlist position or tracknumber tag, just like Jemplode.
_________________________
Tony Fabris

Top
#87012 - 21/04/2002 19:22 Re: Hijack wish - configurable http download naming [Re: tfabris]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Padding is easy yes, but most people would set the padding to two characters. In the CDex case, the track number comes as 4 or 5 chars (1/11 etc), so this wouldn't pad correctly. Ignoring the CDex case and no problem, but I can't do that. Otherwise you pad to 5 chars and have 00001 for non CDex tracks (which looks kinda dumb) and 01/11 for CDex tracks. I could start getting smart and looking for the / etc but I think the ID3v2 track field is a string of variable length whereas the ID3v1.1 track field is 2 chars only.

I don't have my development environment here, so I'm not sure if playlist position is easily available. I assume it's there somewhere though. I'll see what can be done.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87013 - 21/04/2002 19:42 Re: Hijack wish - configurable http download naming [Re: Shonky]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31578
Loc: Seattle, WA
IMHO, the "1/11" case is simply an incorrect tag and you shouldn't have to code around it.

I say, give them the "playlist position" field as well as the track number field, like Jemplode does, and all will be well. I have no trouble getting proper track titles when using the Position field, as long as I've got one playlist per albums. In my case, position is a more reliable number than the track number field.
_________________________
Tony Fabris

Top
#87014 - 21/04/2002 23:23 Re: Hijack wish - configurable http download naming [Re: tfabris]
dmz
journeyman

Registered: 15/09/1999
Posts: 91
Loc: Pasadena, California, USA
IMHO, the "1/11" case is simply an incorrect tag and you shouldn't have to code around it.

Unfortunately, it isn't an incorrect tag at all. From the ID3v2.3.0 spec:

TRCK: The 'Track number/Position in set' frame is a numeric string containing the order number of the audio-file on its original recording. This may be extended with a "/" character and a numeric string containing the total number of tracks/elements on the original recording. E.g. "4/9".

The "/total" extension to the TRCK field is actually done by most ID3v2 taggers I've used. So you really do have to code around it, if you want to use the ID3 tag to determine the track number... However, using the playlist position field as Tony suggests is probably good enough for most people. Personally, since I tag all my own tracks, I trust the ID3 tags over any data I might get out of the Empeg's database.
_________________________
Daniel M. Zimmerman Mk.2 #060000058, 36GB Mk.1 #00101, 10GB

Top
#87015 - 23/04/2002 20:04 Re: Hijack wish - configurable http download naming [Re: pgrzelak]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
OK Paul (and others)

My first pass:

Give this a try (Mk2 only since Mk1 doesn't have ethernet)
Mk2 Image + Hijackv262
Patch against v262 Hijack

Just patch against a kernel patched beforehand with Hijack. Should patch against most recent versions of Hijack.

In config.ini in the [hijack] section place a line such as
khttpd_format_string=%a - %s - %n - %t
which would give e.g.
Joe Satriani - Surfing With The Alien - 04 - Always With Me, Always With You.mp3

Fields blank in the ID3 tag will simply not appear in the final string. A track number of 0 will disappear too.

Options are
%a - for artist
%s - for album (source)
%n - track number (zero padded to two digits. max of 3 digits)
%t - title
%y - year
%% - percentage (don't know why you'd want one though)

Be wary of percentages. IE turns them into characters if they are followed by numbers so that's not real great. Don't use them if possible.

Also you'll find that if you have a song with a bad (for your operating system) file character (?, *, /, \ etc for Windows), IE will do some strange things. I haven't allowed for any filtering here. The original hijack didn't either.

Maximum length is truncated at 127 chars + the file extension and the format string is limited to 31 chars.

If you don't have the string it will default to what it used to be which is the equivalent of :
khttpd_format_string=%a - %t

Let me know. I am sure there will be more than one iteration of this. Are there any other fields people might want?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87016 - 23/04/2002 21:54 Re: Hijack wish - configurable http download naming [Re: Shonky]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Oh and I know the code's not a work of art, but it works and doesn't seem to slow things down much at all.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87017 - 24/04/2002 07:32 Re: Hijack wish - configurable http download namin [Re: Shonky]
tms13
old hand

Registered: 30/07/2001
Posts: 1115
Loc: Lochcarron and Edinburgh
I didn't compile it to try, but it looks like "%%" will get substituted as "%%" - there's no way to get a single "%" character.

And
In reply to:

Be wary of percentages. IE turns them into characters if they are followed by numbers so that's not real great. Don't use them if possible.


That looks like you're making URLs without escaping reserved/unsafe characters properly (IOW, IE is probably doing the Right Thing). I bet that track names containing '%' give you trouble, as well as artists like "AC/DC"...

I think the right thing to do is to make a second pass over the resultant filename, to URL-encode it.
_________________________
Toby Speight
030103016 (80GB Mk2a, blue)
030102806 (0GB Mk2a, blue)

Top
#87018 - 24/04/2002 07:51 Re: Hijack wish - configurable http download naming [Re: Shonky]
thenominous
member

Registered: 22/12/2001
Posts: 189
Loc: UK
Hi Shonky,

Thanks for the effort mate, but would it be possible for you to upload a kernel which has been both Hijacked and HTTPname patched please?
Saves having to figure out how to do it under windoze

Top
#87019 - 24/04/2002 15:59 Re: Hijack wish - configurable http download naming [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14484
Loc: Canada
Can this not be done using that wonderful XML stuff I implemented specifically to avoid future customization issues?

If not, I wonder why we have it in there?
I don't (can't) use it.

Cheers

Top
#87020 - 24/04/2002 19:41 Re: Hijack wish - configurable http download naming [Re: thenominous]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
There is a link in my post that has an Image with v262 Hijack and the rename patch. If that's not what you want, what do you want?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87021 - 24/04/2002 19:45 Re: Hijack wish - configurable http download naming [Re: mlord]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
In reply to:

Can this not be done using that wonderful XML stuff I implemented specifically to avoid future customization issues?




Possibly. I have no idea how XML works. I assumed that this needed to be a Hijack thing. I thought I saw a post by you stating you would accept a patch for this which made me think it had to be a hijack thing. (edit : Actually it was this thread where you said it)

If someone can do it in XML feel free. It didn't really take me that long to implement...


Edited by Shonky (24/04/2002 19:52)
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87022 - 24/04/2002 19:50 Re: Hijack wish - configurable http download namin [Re: tms13]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Yeah I know that. I wanted to see if it basically worked the way people wanted first. Also remember that different OSes/filesystems have different restrictions, so what may work in Linux won't necessarily work Windoze

The % stuff needs some special stuff to work in IE. A percentage is definitely possible but what may work in IE may not work in Mozilla/Opera etc

_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#87023 - 25/04/2002 05:23 Re: Hijack wish - configurable http download naming [Re: Shonky]
thenominous
member

Registered: 22/12/2001
Posts: 189
Loc: UK
<slap head hard> It didnt work for me, but it does now..

I didnt change anything in the config.ini file so it should be the default artist and title.

It would seem that it doesnt work with Download Accelerator, but it works fine with standard IE saving as I have found now. Your links confused me a ittle since it didnt work at the time...

Thanks for the effort mate!

Top