Help with filenaming pattern

Oh, man. This thread is overwhelming. I’m so very confused. Firstly, it seems that everyone wants their directories to be arranged by letter (A>Artist,The>Album>Track)… and tracks and artists have underscores instead of spaces. I can’t understand why someone would want “Beatles, The” instead of “The Beatles”. I can’t understand which parts of the scripts to copy/paste, and I don’t know what plugins are necessary to achieve my desired structure. I just want this:

L:\MUSIC\My collection\FLACs\2Pac\2Pac - 2Pacalypse Now (1991) [FLAC]\01 - Young Black Male.flac

Wouldn’t that be a simple script?

I’ve read through this thread and all I got was a headache. If anyone could help me out I would be grateful as heck. I’m not trying to skip doing my due diligence, but I don’t even know where to start.

You might want to check out the Writing a File Naming Script tutorial in the Picard User Guide. That should help clear up some of the confusion.

2 Likes

Don’t worry, this thread is pretty much a place for people to put their ultra complicated and confusing scripts :laughing:

Start where rdswift pointed you and your headache will clear up no problem.

Oh man, I’ve got to bite. Having worked in a library it can make a lot of sense. There are countless cases where you don’t know if ‘the’ is actually part of the name/title.

e.g. You’ve read an article that mentions a band -“The Brainzicles was another popular…” - and want to know more. And then you go search a whole row of ‘B’ books. Nothing! Oh wait, ‘The’ is actually part of the title so its in another row of shelves (if there’s anything). Better to just leave the ‘the’ out of the ordering every time and not worry about the whole thing

Obviously books at the library aren’t arranged by band name, but you get the gist!

p.s. I personally don’t move ‘the’ to the back in my music collection, because I browse using the search function in my player, which takes care of the above mentioned problem

I’m sorry guys, but…

I went through that guide step-by-step until I got to the naming conventions and scripting examples, and it made less and less sense to me with each page. I followed the guide to setting up my options and when it suggested I read that document I read it. When I got confused as heck, I came here and read this thread for 2 hours. When I still had no idea how to do what I wanted, I signed up for an account here and made this request for help.

Why would you assume that someone would just randomly sign up for an account here without trying to figure things out first?

Not to be rude, but I’m kind of off-put by the suggestion to just rtfm. I’m trying. I really am. And I’m fully prepared to admit that I’m just not that bright. But your comment really wasn’t helpful. I know you are very active in this thread, and I don’t begrudge you any respect for your knowledge. But I really need some help understanding the very basic concepts, which don’t seem to be elucidated very clearly or simply in the document you linked to, and that I have tried to read and learn from.

This page helped me a lot though:

And, due to the thorough explanation in simple terms I was able to do what I wanted.

But thanks anyway.

BTW, I use Everything search by VoidTools and never have any trouble finding what I need, whether it starts with “The” or not. I’ve definitely had some moments with “The Butthole Surfers/Butthole Surfers” and “The Misfits/Misfits” where I thought I was going crazy, though.

Your post implies that your primary starting point is this thread, so a link to the correct docs to start from wasn’t meant as an insult I’m sure. Sorry anyway though!

Btw @rdswift pretty much solo writes and maintains that documentation (as a volunteer!!) so specific feedback on what was confusing might be something he can keep in mind.

2 Likes

Your post implies that your primary starting point is this thread, so a link to the correct docs to start from wasn’t meant as an insult I’m sure. Sorry anyway though!

I’m being sincere, here. I don’t understand how (or why) anyone would find this thread without doing some research of their own. That’s why I don’t think it’s “implied” that this was my starting point.

As for the guide itself and how it failed to enlighten me, I need a progressive set of instructions that are followed by examples of the output from each new piece of terminology. The explanations are self-referential. It’s sort of like a dictionary entry that says “mad: see the definition for angry.” And the entry for angry says “see the definition for mad.” The terminology was overwhelming and made too many assumptions about what the average person understands about scripting. I was lost before even getting through the definitions of the terminology. The guide seems to want to cater to the very complex use-case that the author prefers, rather than starting with very basic explanations and use-case examples for the average user. Start there. Then move on to more complex strings and snippets for those who want to fine-tune their expressions further.

I even went to @rdswift 's github pages and found nothing there that was helpful.

Again, as I said, I need only a very simple string to arrange my collection. I would modify my needs to separate mp3s from FLACs and include those terms in the album file folder name like this:

/music/FLACs/Mudhoney/Mudhoney - Superfuzz Bigmuff EP -1988 [FLAC]/01 - Need.flac to keep the FLACs and mp3s separate so I’d also have:

music/mp3s/The Tallest Man on Earth\The Tallest Man on Earth - 2006 - [mp3]/1 - It Will Follow The Rain.mp3

I’m so lost and desperate I’d even pay for help - that’s how I feel right now.

I’m going to go through everything again today and see if I can get my s**t straight, but I’m feeling pretty hopeless. Sorry to be a beggar, and I don’t usually need help with anything regarding basic computing (I build them, I triple boot OSes, I use the CLI quite a bit - I’m really not that dumb.) But this is taking up hours and hours and hours to keep failing, and it’s messing up my collection and making me frazzled to where I have even less patience for parsing the dense guide.

1 Like

I think that you’ll find most people here are genuinely trying to be helpful. You’ve told us how you’d like to see the output, so if you post the naming script that you’re currently using so we have a starting point, we can likely suggest changes that will produce your desired results. One other thing that I ask you to clarify is the year that you want to use. I assume that it’s the year of the release, or is it the year of the first release of the album?

3 Likes

This is what I have so far:

$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album% - $left(%date%,4)/)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

I can’t believe how quick and responsive you are. I really REALLY appreciate it. I’m not sure if that is the year of the first release, or the year of the specific year of that particular release, but I guess I’d prefer the year of the first release.

I didn’t even get a chance to open the guide again yet, to look for more specific answers to my new query.

You’re fast.

I am looking, though, not just slacking. I just reverted back to the default and that is definitely not adequate for my needs.

1 Like

Give this a try and see if it’s close to what you want:

$set(_filetype,$if($eq(%_extension%,flac),FLAC,$if($eq($lower(%_extension%),mp3),mp3,)))
$if(%_filetype%,%_filetype%s/,)
$if2(%albumartist%,%artist%)/
$if2(%albumartist%,%artist%) - %album% - $left(%_releasegroup_firstreleasedate%,4)
$if(%_filetype%, [%_filetype%])/
$if($gt(%totaldiscs%,1),%discnumber%-,)
$num(%tracknumber%,2) - $if(%_multiartist%,%artist% - ,)%title%
2 Likes

He is called swift… :wink:

4 Likes

Welcome to the jungle :joy:

I am a coding dumb-dumb btw, and this is the part of the docs that helped me find a way in:
https://picard-docs.musicbrainz.org/en/tutorials/naming_script.html
If statements etc are the next step up. Luckily rdswift has you covered eh!

This is great, but an unforeseen problem has occurred, so I’m eating my shoe a bit …

I have .m4a and wma files as well (and possibly others. I may delete these if I have the appropriate FLAC replacements, but for now I’d like to get them sorted.)

$set(_filetype,$if($eq(%_extension%,flac),FLAC,$if($eq($lower(%_extension%),mp3),mp3,$if($eq($lower(%_extension%),mp4,mp4,$if(($eq($lower(%_extension%),wma,wma/)))))
$if(%_filetype%,%_filetype%s/,)
$if2(%albumartist%,%artist%)/
$if2(%albumartist%,%artist%) - %album% - $left(%_releasegroup_firstreleasedate%,4)
$if(%_filetype%, [%_filetype%])/
$if($gt(%totaldiscs%,1),%discnumber%-,)
$num(%tracknumber%,2) - $if(%_multiartist%,%artist% - ,)%title%

-----------------------------------------------------------
or
-----------------------------------------------------------
$set(_filetype,$if($eq(%_extension%,flac),FLAC,$if($eq($lower(%_extension%),mp3),Lossy/,))
$if($eq($lower(%_extension%),mp4,mp4,$if(($eq($lower(%_extension%),wma,wma,))))
$if(%_filetype%,%_filetype%s/,)
$if2(%albumartist%,%artist%)/
$if2(%albumartist%,%artist%) - %album% - $left(%_releasegroup_firstreleasedate%,4)
$if(%_filetype%, [%_filetype%])/
$if($gt(%totaldiscs%,1),%discnumber%-,)
$num(%tracknumber%,2) - $if(%_multiartist%,%artist% - ,)%title%

Both seem close but I know neither of them is right without even testing them.

I really don’t care to separate the different lossy filetypes into their own directories. Using your script leaves them in their own folders outside the main two, which I can still fix manually, but my collection is quite large.

So yeah, I’m embarrassed at my previous posts claiming my needs were simple. That doesn’t seem to be the case. I’m still looking - I know these two attempts were pretty weak.

But seriously, I do appreciate your time. I’m hoping that you really do get some satisfaction from helping, otherwise I can’t see any logical reason for it. My only analogy is that I’ve spent more than twenty years helping people identify mushrooms on the internet, on forays, and at mushroom shows - both because I’m passionate but also because I have this tiny bit of philanthropic bent.

Thank you.

1 Like

Try this:

$noop( Identify the extensions to sort separately, entered as lower case. )
$setmulti(_sorted_ext,flac; wav; m4a; wma)

$noop( Check if file extension is in the sort separately list. )
$set(_sorted,$if($inmulti(%_sorted_ext%,$lower(%_extension%)),True,))

$noop( Set top directory as upper case sorted extension or "Lossy". )
$if(%_sorted%,$upper(%_extension%)s,Lossy)/

$noop( Set artist directory. )
$if2(%albumartist%,%artist%)/

$noop( Set album directory. )
$if2(%albumartist%,%artist%) - %album% - $left(%_releasegroup_firstreleasedate%,4)

$noop( Add file type to album directory, upper case if in sorted list otherwise lower case. )
$if(%_sorted%, [$upper(%_extension%)], [$lower(%_extension%)])/

$noop( Add disc and track number. )
$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2)

$noop( Add track artist if a various artist release, and track title. )
$if(%_multiartist%, - %artist%,) - %title%

As you can see, I added some comments so you can see what each line is doing.

4 Likes

@JeremiahWasABullFrog

Did the above script help address your needs? I’m just trying to close the loop on this.

1 Like

Oh, man. I actually started using the smaller script above and went through about a terabyte of files before I saw this.

I came back in to thank you, and didn’t expect further help in the thread.

I’ll give this one a whirl and see how much time it saves me (probably a little, though my non-mp3 and non-FLAC files are actually very few).

I’m sorry it took me so long to respond, and thank you from the bottom of my collection for this fabulous assistance. You are, as they say, the man.

Now… if only I could tag all this stuff that Musicbrainz and mp3tag can’t find, I’d be set. Elvis and Dolly Parton are pains-in-my-ass.

Again, thanks, and I’m basically set!

3 Likes

Sorry if this is too basic, but I couldnt figure out in the script.
Is it possible to make the artist folders like
~ F ~\Firstname Lastname
rather than
~ L ~\Lastname, Firstname
but still keeping A, An, The at the end?
Thank you

Which script do you mean? Are you referring to the file naming script that I use and have posted on GitHub? What you’re asking for can certainly be done, but before I can help you modify your script, I need to know exactly the script you’re using.

Yes, I am using your script and tons of thanks for sharing it with everybody. It really is awesome!

I think that making the following changes should do what you’re asking. Note that I haven’t tested this.

Change Line 130 from

$set(_nPAA,$if2(%_artists_album_primary_std%,%albumartist%,%_cUnknownArtist%))

to

$set(_nPAA,$swapprefix($if2(%_artists_album_primary_std%,%albumartist%,%_cUnknownArtist%),A,An,The))

Change Line 159 from

$set(_nInitial,~ $upper($firstalphachar(%_nFAAPS%,#)) ~/)

to

$set(_nInitial,~ $upper($firstalphachar(%_nPAA%,#)) ~/)

Change Line 312 from

$if($eq(%_nAlbumType%,Single),$set(_nFilePath,%_nInitial%/%_nPAAS%/%_cSingles%/))

to

$if($eq(%_nAlbumType%,Single),$set(_nFilePath,%_nInitial%/%_nPAA%/%_cSingles%/))

Change Line 317 from

        $set(_nFilePath,%_nInitial%/%_nFAAPS%/%_nYear% %_nANT%/)

to

        $set(_nFilePath,%_nInitial%/%_nPAA%/%_nYear% %_nANT%/)
2 Likes

Perfect! I changed it and worked smoothly!
Will let you know if if I see an error. Many thanks!!!

1 Like