Help getting started with scripting

Tags: #<Tag:0x00007f58f2da7350> #<Tag:0x00007f58f2da7288>

Hi, I apologize as I’m pretty sure the question has already been answered in this lengthy post, but after sifting through for about an hour, I have this huge headache and anxiety building up so figured I had nothing to lose asking, whereas I WILL lose my mind if I try to do this on my own lol.

Here it goes :
I can’t seem to find a script for my specific needs. I want to tweak the ‘‘Default’’ script for it to add the release year in brackets [ ] in front of the album title. That way, albums will be sorted by release year instead of alphabetically.

Also : I tried copying/pasting one or two scripts to see how it paned out, but it didn’t seem to work. Example : Tried adding a script to move featuring artists after the track title. In the preview, I noticed some information was being repeated. Thing is, I didn’t remove the ‘‘Default’’ script. I thought I could just layer them. Is that not the case?

If there is an informative page to clearly explains how to write a script, I am all ears. :slight_smile: I looked around on the Picard website but I only found vague or surface information.

Thanks! Cheers from Montreal

  • Isabelle
1 Like

It sounds like much of what you want is included in my naming script. You can find it on GitHub, and it has some comments throughout to help explain what’s going on.

Not for file naming scripts. There is only one file naming script used. You can have multiple tagging scripts though.

Not specifically how to write a script, but the Picard User Guide has a section on Scripting which explains the difference between the two types of scripts, as well as an overview of scripting and a list of the scripting functions. Each function includes a description of what it does along with an example of how it is used.

Hopefully some of this helps.

2 Likes

Wow thanks for the swift answer! (See what I did there?) I will write back if I have any more questions. Very greatful. ^^

1 Like

Ouff after reading through it, I must admit I don’t understand any of this. :frowning: I’m quite uneducated when it comes to coding. If it’s not too much to ask, do you think you could copy/paste what I would need for adding the year in front of albums? I’m so confuzzled haha!

One last thing to read, and that’s the tutorial on Writing a File Naming Script which I forgot that we recently added to the documentation. If you’re still unable to get it to do what you want, then please post a copy of your current file naming script and we can show you how to modify it to add the release year.

2 Likes

Sorry for the late reply! Thanks for this. I will look it up.
I kinda gave up on having my files named how I wanted to, seeing how complicated it was.
I’ll give it another try (because I’m really annoyed that my files aren’t named the way I would like).
Will get back to ya if the need arises. Cheers from Montreal!

OK I read the page you linked me, but it doesn’t compute…
Basically, what’s happening is that I have a lot of individual tracks. I often don’t take whole albums.
But the program still saves my files with the track numbers first. Plus, the artist name doesn’t show.
Also, it saves the tracks in individual artist files. I don’t want that. I just want them saved as is, without creating an individual file for each.

For now they look like this : Track # - Track title
And I would like them to look like this : Artist - Track title

When I do have full albums, I don’t like having a bunch of subfolders like some people on here. I like to keep things simple. I would like my album folders to be named this way :
Artist - Year Album name

Without spacing or dashes between the year and album name (ex : Tommy Guerrero - 2018 Road to Nowhere) and then in that folder have the tracks with track number first, without artist name in front).

Is that possible? To have different setting if it’s a single track VS a whole album? I have the original script only. Didn’t feel confident putting any add-ons…

The original naming script is pretty basic and won’t do what you want. You have no choice but to modify it.

If I understand you correctly, you want all incomplete albums (single tracks and such) to be in the same destination directory with the file name in the format Artist - Title, and each complete album to be in a subdirectory of this destination directory, with the subdirectory name in the form Artist - [Year] Album with each of the tracks in the subdirectory named in the form Track Number Title. In that case, I think a file naming script like the one below will do what you want.

$if($and($eq(%_primaryreleasetype%,album),$is_complete()),
%albumartist% - [$if2(%originalyear%,0000)] %album%/$if($gt(%totaldiscs%,1),%discnumber%-,)$num($if2(%tracknumber%,0),2) %title%,
%artist% - %title%
)
1 Like

Thank you for taking the time to answer!

Something weird happened. The first few saves I did worked well, but now all the tracks, album or not, save as individual tracks. Do you know what went wrong? :confused:

Edit : It seems like the ‘‘album save’’ type only works when album are really long. Thing is I have 4 track EPs sometimes, that will save as individual tracks. I tried editing the ‘‘release type’’ to ‘‘album’’ but it didn’t change anything.

That’s because the releasetype for them is “ep” rather than “album”. The following should keep the full ep’s together as well as the albums.

EDIT: Non-working code removed.

Thanks ! If for a mysterious reason the album still doesn’t save as a whole, is there a tag change possible for this to happen? I really thought changing the release type to ‘‘album’’ would do the trick.

Not really. In fact, the revised script I just posted above will NOT work, because the $is_complete() function only works for primary type ‘album’. The following will sort of work, except that it will save the ep’s as albums, even if you don’t have all of the tracks.

$if($or($and($eq(%_primaryreleasetype%,album),$is_complete()),$eq(%_primaryreleasetype%,ep)),
%albumartist% - [$if2(%originalyear%,0000)] %album%/$if($gt(%totaldiscs%,1),%discnumber%-,)$num($if2(%tracknumber%,0),2) %title%,
%artist% - %title%
)

Hmmm doesn’t seem to be working, it saves everything as single tracks.
Was I supposed to keep the first script and simply add to that?

That’s odd because it seems to be working perfectly here. Are you processing full albums at a time so that all of the tracks are matched to a file before saving?

Yeah ! :confused: It worked for a while… now it doesn’t. I copy/pasted the first script you gave me.

Yup just tried all 3 scripts on here and they all result in individual tracks only, no album folders

What release are you trying to process? If possible, please provide the link on MusicBrainz so I can try working with that here.

It’s really kind of you to help me with this, thanks.
Ok example : Sven Laux - Schachmatt
(I really recommend his music by the way if you enjoy piano)

I didn’t have anything that needed modifying except the title name, so I only pressed ‘‘cluster’’, then ‘‘save’’. It saved in the folder reserved for properly tagged and named files, but as individual tracks.

So you’re not matching it to a release from MusicBrainz in the right-hand pane and then matching files to tracks? If not, that’s your problem, because $is_complete() is not seeing the album as being complete so it’s saving the tracks individually rather than as an album.

Ok then is there a way to rename files without them being matched? Because not all of my music is matched. :confused: