Jump to content

Album Tag Importer


Recommended Posts

Posted

I'm excited to try it out!!!

Will probably take me a while to set it up and test, hopefully I won't get stuck!

Cant' do it right now though, as have to do non-Emby things for a while... 

Posted (edited)

@GrimReaper Well, this is looking really good so far...

It looks very Emby-like and the overall UI is easy to follow with what is going on - nice job!!!

Here's what I have found so far:

1. LIbrary: All enables all Artists in the Album Artist drop-down menu - is this intentional for a certain reason?

2. Library: Music enables only Album Artists in the drop-down menu - this is good and very useful!

What could also be useful for me here is possibly having #, A, B, C......Z sections at the folder level, below Music and above Album Artists. Then I could run an Album, an Album Artist, an "alphabet block" of Artists or All??? I can't imagine using "All" very often - is that a function(?). But I bulk edit at the "Alphabet" folder level quite often. This could also potentailly give smaller drop-down menu options. (due to my country flag Artist prefixes - the typing option is not that practical for me) Defintely a "nice to have" rather than a "must have".

3. Once Album Artist is selected, the Album: All or a specific single Album in the drop-down menu is good.

4. Write RELEASETYPE tag as-is works for a single album 🎉

5. Write RELEASETYPE tag as-is works for all Albums of an Album Artist in bulk 🎉🎉🎉

4. Write ROONALBUMTAG tag as-is works for a single album 🎉

5. Write ROONALBUMTAG as-is works for all Albums of an Album Artist in bulk 🎉🎉🎉

🎉💯 Having RELEASETYPE and ROONALBUMTAG both separately importing directly into Emby Album Tags is a great feature and very beneficial. This means RELEASETYPE can be kept for it's specific purpose, leaving ROONALBUMTAG for other miscellaneous tags. Irrespective of potential time savings (which I have no doublt there will be), it is now much more worthwhile to create Album tags in Mp3tag and make use of them!!! 💯🎉

My initial thought is this is quite brilliant. But, there is also a useabilty issue where tags can be added but they cannot be deleted. Usually if I am modifying music tags for existing Albums, its because I'm changing my tagging system in a specific field - adding, deleting, renaming all at once.  Then, when rescanning in Emby all these changes typically take effect. 

Maybe, if the function was (e.g.) Write RELEASETYPE field as-is for all tags in that field, then that would possibly sychronize everything nicely???

6. I have just got to the Map Specfic Modes but haven't tested enough just yet...

7. I like the progress indicator in the Run section. I can imagine that the Stop button will be handy!

8. No feedback on the bottom sections yet, I havent gotten that far...

Beyond the functionality, the overall UI layout works very well. Some of the text is difficult for me to read, so I increased the font sizes and changed the font color to black. That was just to make it easy for my bad eyesight! This pushed the bottom of the window off my screen, so I just reduced the height of the Live Log section to make it all fit.

I've only tried a few "test" tags so far, but once I get a bit more familar with the operation, I'll soon be doing "real" tagging!!! Cheers!

P.S. Or with the deleting Tags issue, perhaps a "Clear Emby Albums Tag Field" button??? No bother either way if you don't have time to iterate this current version any further - I'll still be using it as is....

Edited by user24
Added P.S.
Posted
10 hours ago, user24 said:

What could also be useful for me here is possibly having #, A, B, C......Z sections at the folder level

Which "folder" level? On your filesystem? Folders added as library paths? Or AlbumArtists by letter? But that last one would likely put all of your artists under # due to the country in the title - if they're all named as example Beatles you've sent me. 

Posted (edited)
10 hours ago, GrimReaper said:

Which "folder" level? On your filesystem? Folders added as library paths? Or AlbumArtists by letter?

It's the filesystem sub-folder path under Music. These folders also show up in my Emby Music Folders menu tab. So for "The Beatles" it would be "Bb (a-m)" as per the PM folder structure that was sent.

From your question, I think I've figured it out myself by changing the fetch_libraries() function to include sub-folders. I also changed  the include_all flag from True to False to hide the "All" entry. 

Here are "before" and "after" screenshots examples:

image.thumb.png.b734708b281fdc014a3d02cda79a52e0.png

I don't think I broke anything because RELEASETYPE tags can be still be bulk written into Emby Album tags.

Yeah, the country prefixes do cause some issues, but I guess the API is using the Sort Title??? All my Album Artists have Sort Titles, e.g.

image.png.c1eb14817c0d1578ef8ecd39d40ecdf6.png

Emby will automatically remove "The" but not "🇬🇧 The". That's why being able to import ALBUMARTISTSORT would be useful.

I could perhaps try modifying system.xml but haven't gotten around to it yet:

<SortRemoveWords>
    <string>the</string>
    <string>a</string>
    <string>an</string>
    <string>das</string>
    <string>der</string>
    <string>el</string>
    <string>la</string>
Edited by user24
Posted (edited)
20 hours ago, user24 said:

1. LIbrary: All enables all Artists in the Album Artist drop-down menu - is this intentional for a certain reason?

@GrimReaper I think I may have some clues on this as well, but not 100% sure??? In Emby 4.8 you could fetch AlbumArtists, Artists and Composers via the API with standard queries. But in Emby 4.9, the same queries no longer worked and returned AlbumArtists+Artists+Composers for all three individial fetches. But, when User_ID was added to the queries, they worked again. 

Just mentioning in case it helps you out for anything??? As per post above, I've hidden the "All" option.

Edited by user24
GrimReaper
Posted
1 hour ago, user24 said:

It's the filesystem sub-folder path under Music. These folders also show up in my Emby Music Folders menu tab.

Are those folders added separately/individually as Music library paths?

Posted

No. My music library is just: \\DS218PLUS\music. In the PM the example paths are direct copy+paste from Windows and Emby.

I used this code and it seems to be working - but I don't know if this is the best approach or not???

def fetch_libraries() -> list[dict]:
    # get top-level virtual folders
    data = requests.get(
        f"{SERVER}/emby/Library/VirtualFolders",
        headers=HEADERS, timeout=15
    ).json()

    # find the main music library
    music_lib = next((x for x in data if x.get("CollectionType") == "music"), None)
    if not music_lib:
        return []

    # fetch one level down inside that library
    subfolders = requests.get(
        f"{SERVER}/emby/Items",
        params={"ParentId": music_lib["ItemId"], "IncludeItemTypes": "Folder"},
        headers=HEADERS, timeout=15
    ).json().get("Items", [])

    # return: first the main library, then its subfolders
    return [music_lib] + subfolders

 

 

  • Thanks 1
GrimReaper
Posted

That's OK, I just wanted to know exact library setup within Emby for which endpoints to use. 

All clear now, I should have an update within the hour. 

  • Like 1
GrimReaper
Posted (edited)

Try this version.

v0.2

- Script renamed to better indicate function

- UI reworked

- Folder selection added

- 2 extra modes added (Add/Replace)

image.png.27bcc57f6ae10ebe066b4cd363b65858.png

image.thumb.png.46228d70e5e3c65108286e546dc63060.png

 

Edited by GrimReaper
Script removed
Posted

Screenshot looks great, and very promising, with the new functions!!!

I'll test it out as soon as I can. Will likely be tomorrow, your time, before I can give any detailed testing feedback... stay tuned... ☺️

  • Agree 1
GrimReaper
Posted (edited)

v0.3

- Selection logic refined to reduce number of calls (faster UX)

- UI reworked (QoL improvements)

- Improved logging

 

I need a screenshot of one in-progress window, there's something I need to check and I cannot do it on this test library as it's too fast, script needs to sun for few seconds, I'm doing it blindly. Thanks.

 

 

Edited by GrimReaper
Posted
15 hours ago, GrimReaper said:

I need a screenshot of one in-progress window

Screenshots below - start-halfway-finish. Dry-run "on" or "off" seems to give exactly the same logging progress results. The green progress bar moves step-by-step and a new line appears in the live log as each album is completed. Halfway length along the bar also aligns well in real time (e.g.) halfway takes 1:14 and completion takes 2:28. A comparable "scan" takes roughly about 30-40% of the time of Mp3tag. Let me know if you need more on this?

image.thumb.png.0460b5eb35badc7d6d1f1af50354a076.png

 

Posted (edited)
22 hours ago, GrimReaper said:

- Folder selection added

The four sections (now including Folders) are excellent! Very useful for anyone with very large music libraries that uses either Alphabetical, Genre or Custom folder organisation above the Album Artist folder level. Beyond testing this, I can already imagine the large-scale practical usefulness of this. The item counts are a nice addition. This gives extra info, and, when a selection is made, the change of count is another indication that "everything" is working as it should.

There still seems to be a problem when Library "All" is selected. This returns all Artists rather than just Album Artists. Here are screeshots:

image.thumb.png.a6e3b36cd76de3085bf64afbb14dbfa5.png

First image above - Album Artists stop at the software limit of 5000. Everything from "Beck" to "Ben Harper" is an Artist entity only. Apart from the Allbum Artist count being way too high, the entries have no country flag codes - so, with my set-up, it is immediately obvious. Also, the 88 Album Count is weird and I can't correlate it with anything??? Folder 29 count is correct. Library 1 count is correct.

Second image - as soon as Library "Music" is selected the Artists disappear and the counts of 2,235 for All Album Artists and 8.791 for All Albums are correct.

Third image - the 194 count for "Bb (a-m)" Album Artists is correct. The 45 count for all "The Beatles" Albums is correct

Looking good overall. More general UI comments on this section to possibly follow later...

Edit. ignore the comment about the 88 Albums - it may have been from another count and didn't properly update before I captured the screenshot??? I now get 9,103. While it don't know what it is, at least it now seems like a logical count, as "All" would theoretically be a higher count than "Music".

 

Edited by user24
GrimReaper
Posted (edited)
1 hour ago, user24 said:

Screenshots below - start-halfway-finish. Dry-run "on" or "off" seems to give exactly the same logging progress results. The green progress bar moves step-by-step and a new line appears in the live log as each album is completed. Halfway length along the bar also aligns well in real time (e.g.) halfway takes 1:14 and completion takes 2:28. A comparable "scan" takes roughly about 30-40% of the time of Mp3tag. Let me know if you need more on this?

image.thumb.png.0460b5eb35badc7d6d1f1af50354a076.png

 

Thanks for the screenshots, looking good, just needed to see that Stop button and counters while running. You could also stop process once, there should be different message bottom right corner. 

24 minutes ago, user24 said:

There still seems to be a problem when Library "All" is selected.

I'll look into it, but for now you shouldn't have any issues as script should by default start on first (and if you have only one: the only) library of type "music" found. Will look into All selection. 

Edited by GrimReaper
Posted

The counters will be good for bulk editing large batches of files. Mp3tag has something comparable and I rely on it a lot:

image.png.dbba523a77e51381c7803cacfc51a373.png

Yeah, "Stop" gives "Task cancelled" message.

No worries about the "All" issues, I csn't think of a use-case for me, but perhaps people with multiple small music libraries would use it - I don't know???

  • Thanks 1
GrimReaper
Posted (edited)

Give this version a spin.

v0.4

- Selection logic revised

- Track modes added (Single-track/Multi-track)

Edit: Also, any glitches observed in Summary modals?

Edited by GrimReaper
Script removed
  • Thanks 1
GrimReaper
Posted (edited)

v0.5

- GUI reworked (Toggle pills adjusted)

image.thumb.png.103d6c0123467d7268931d33f22e7644.png

 

image.thumb.png.f96da4cc3a1b38b6119520e60bfcf4d5.png

 

 

Edited by GrimReaper
Script removed
  • Thanks 1
Posted

v5 ⚡👹🚀  !!! Super Speed Demon !!! ⚡👹🚀 v5

(perhaps shoulda been v8 ???)

Mp3tag: 6min35sec writing 1 tag to 1270 tracks over wireless network doing several other things.

Emby_Album_Tag_Importer:  0min8sec writing the same 1 tag from, single Album track, on same network

All Artists problem is fixed - now just Album Artists.

image.png.0416f046b55d00e389921fad515bd0b1.png

Reports can be generated and exported for Excel (just a quick test so far).

Error logging works as follows (from earlier today):

image.png.4e4ea249d8f2d1075d0a4208deba5a48.png

There was a massive long path. A long Disc subfolder under the main Album folder, plus the track_name.flac. It seemed to be only 220 characters (under 260 limit?), but I shortened the overall length to 110 chracters and all was good!

  • Like 1
GrimReaper
Posted
21 minutes ago, user24 said:

v5 ⚡👹🚀  !!! Super Speed Demon !!! ⚡👹🚀 v5

(perhaps shoulda been v8 ???)

Mp3tag: 6min35sec writing 1 tag to 1270 tracks over wireless network doing several other things.

Emby_Album_Tag_Importer:  0min8sec writing the same 1 tag from, single Album track, on same network

👌 

Posted (edited)

Just grabbed the latest v0.6 - thanks - will give it a go soonish. I really want to try the Mapping next, and now there is Custom as well!

Was playing around with the GUI a bit - I have a few tentative ideas, but it's hard to know where the line is crossed between useful info and visual clutter, without doing a full mock-up.

Currently we have these Main Sections:

  • Selection
  • Mode
  • Method
  • Mapping (default hidden)
  • Run
  • Live Log (including end results/reports)

I tired to descibe the Section Functions in only two distinctive words each, perhaps something like:

  • Select Albums
  • Import Mode
  • Tag Method
  • Tag Mapping (default hidden)
  • Run Process
  • Activity Log
  • View Results (not sure about this being necessary?)

I was also trying to imagine what the work-flow would be like, by swapping the Mode and Method order? I have been tending to jump past Mode straight into Method and forgetting to go back to it, before hitting Run. Only more use will tell what may be more intuitive (irrespective of the underlying logic).

  • Select Albums
  • Tag Method
  • Tag Mapping (default hidden)
  • Import Mode
  • Run Process
  • Activity Log
  • View Results (not sure about this being necessary?)

Mode could be even more useful with one extra function button - CLEAR.  If you have time to add it, feel free to change the colors, to whatever you think will work. I did try traffic light colors, but yellow/orange didn't really work. I don't mean for them all to be on at once. They would still only color highlight on click/tap selection, the same as the green and red do now. CLEAR would not even have to read any embedded tags - it would just access the Emby field/tags, I assume???

image.thumb.png.831e8f03f028fdc8e543063c686f6466.png

Then, looking at the whole GUI, perhaps the single/multi selector could be aligned (on LHS) and matched with the dry-run selector. It might take a bit of juggling the info to make it match nicely. Sorry, I haven't done a mock-up of this. Only just thought of it. It may save some vertical space or it could look worse???

Now, back to that Mapping testing...

Edited by user24
GrimReaper
Posted
39 minutes ago, user24 said:

Mode could be even more useful with one extra function button - CLEAR.  If you have time to add it, feel free to change the colors, to whatever you think will work. I did try traffic light colors, but yellow/orange didn't really work. I don't mean for them all to be on at once. They would still only color highlight on click/tap selection, the same as the green and red do now. CLEAR would not even have to read any embedded tags - it would just access the Emby field/tags, I assume???

image.thumb.png.831e8f03f028fdc8e543063c686f6466.png

Why would you ever need to clear any tags, it's done automatically on Replace mode? 

But I'll look into it. 

I'll also look into renaming section. 

GrimReaper
Posted

Tbh, I liked previous iteration/sections order more, but maybe my brain is just wired differently. There's too much going on now, too much up-down mouse movement, the flow simply doesn't feel right. Anyway, here:

v0.7

emby_album_tag_importer.py

Posted (edited)

v0.7

I like the new section headings a lot - thank you!

I think we need the three Import Modes because if a tag field (embedded metadata) is rewritten as blank, it will not be cleared in Emby by the REPLACE function. The first two red error logs below are from the REPLACE command. Then the green log is the CLEAR command:

image.png.69b8af5a2b28434ca5a45aa84e6c7733.png

 

Wonder if you see the same, or am I missing something obvious?

Then, after clearing RELEASETYPE and ROONALBUMTAG fields, I can ADD one tag from each, as next operations.

But, if I then try to ADD additional tags, reading from RELEASETYPE fails.

image.png.c7ad0503eb0df8ac72ee2ab74797dffe.png

 

Can you replicate tihsi?

Also REPLACE seems a bit flakey, when I have two existing tags in the fields and try to replace them with another two tags...

I've run out of time right now to test this further, but there seems to be differences here as well between importing RELEASETYPE and ROONALBUMTAG.

10 hours ago, GrimReaper said:

Tbh, I liked previous iteration/sections order more, but maybe my brain is just wired differently. There's too much going on now, too much up-down mouse movement, the flow simply doesn't feel right.

Agree, now that I have tried it. I'm happy to revert back to your order. The GUI looks better in your original order. I just need to get used to the process - and with your additional CLEAR options, in TAG METHOD section, it doesnt really make sense for that to suddenly appear above IMPORT MODE.

 

 

Edited by user24
Posted
44 minutes ago, user24 said:

I like the new section headings a lot - thank you!

👍 

45 minutes ago, user24 said:

Then, after clearing RELEASETYPE and ROONALBUMTAG fields, I can ADD one tag from each, as next operations.

But, if I then try to ADD additional tags, reading from RELEASETYPE fails.

image.png.c7ad0503eb0df8ac72ee2ab74797dffe.png

 

Can you replicate tihsi?

Also REPLACE seems a bit flakey, when I have two existing tags in the fields and try to replace them with another two tags...

I've run out of time right now to test this further, but there seems to be differences here as well between importing RELEASETYPE and ROONALBUMTAG.

Hmmm, that one might be on me as I didn't clearly explained usage conditions/limitations - or I assumed too much: there is a difference in handling RELEASETYPE and ROONALBUMTAG based on the sample files you've sent me, as I thought RELEASETYPE can ever only have one album tag and one track tag, hence import is restricted to first tag found (before the first semicolon), whereas ROONALBUMTAG is free-for-all, in as many tags as there are, semicolon separated. 

If you want, I can apply same logic to RELEASETYPE but then you'll start getting track tags as album tags - and subsequently track sections in Group by Release Type UI. 

 

image.thumb.png.183c3a788a231e5c8f00805e4f0de4c4.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...