Assign Collections in Database

 
I would like to know if anyone has any ideas on how to batch assign items to a Plex "Collection" either by some command line tool, or directly in the SQLite database.
 
Until Plex adds the functionality to have "sub-libraries" or "sub-folder" management to group like titles together, we will use the Collection feature.
 
As some know, in Windows we like to group our movies together in one folder, like "Star Trek" or "Rocky Movies" where we will group all sequels in one sub-folder underneath the main Plex Library folder.
 
My immediate project, is that I would like to group all Stand Up Comedy together, without creating a new Library just for that category.
So I will create a Collection named "Stand Up Comedy" under the Library "Comedy".
 
I've got a couple of hundred titles in its own Windows folder specifically named "Stand Up Comedy".
 
Is there a way where I can batch assign the entire structure of this folder to the Collection "Stand Up Comedy"?
 
I haven't been able to find a command line tool to do this, but what I have found in SQLite is the following:
 
select * from tags
where tag_type=2
I believe that "tag_type=2" represents "Collections"
 
This will give me the tag id number for the Collection "Stand Up Comedy" that I'm interested in.
Let's call it tag id = 19113
 
Then I am also able to run this query:
select * from section_locations
where library_section_id=6
This gives me the specific ID of the Windows path where "Stand Up Comedy" is stored.
Let's call it section_location ID = 49
 
I then run this query:
SELECT FROM `media_items` 
WHERE  `section_location_id` ='49'
This will give me a list of all the items stored in Windows under my "Stand Up Comedy" folder.
 
 
 
So what I'm missing is this:  Is there a way in the DB (or command line tool) that I can assign everything that has a this specific path (ID=49) to a specific Collection (ID=19113)?
 
 
I realize this may be a little to involved, and I will just have to do it manually at the end of the day, but if anyone has any advice on how to do this, it would be very much appreciated.

Yes this can be done.  I am away from my computer now so I cannot provide exact instructions, but there is a table called "taggings" which links the media_item_id to the tag_id.  You just need to add entries for each media_item_id.  I am actually working on adding this feature to a scripting tool I made.  Should be added in a day or 2 if you want to wait and try it out.

https://forums.plex.tv/topic/120292-m3u-playlist-converter/

Hello,

I have been meaning to do this for quite a while. Were you able to make progress on this @chrischarles2002 ? ( I can appreciate the age of this thread!)

Thank you!

Hello @ajorpheus

Unfortunately, I never pursued this topic further.

No worries. Thank you for replying.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.