# Plexasaurus - Collection Tag Manager

**URL:** <https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [November 26, 2014, 8:24pm UTC](https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232 "2014-11-26T20:24:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![midwire](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/midwire/32/7774_2.png) [@midwire](https://forums.plex.tv/u/midwire)\
**Post date:** [November 26, 2014, 8:24pm UTC](https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232/1 "2014-11-26T20:24:19Z")

</div>

Hello all,

&nbsp;

I am not sure that this is the correct category for this question. Please forgive me if not and let me know where it should be posted.

&nbsp;

I am writing a Plex web application that provides a drag-and-drop interface for collection tags. I have it working, sort-of. However, I am not sure that I am going about it the correct way. I am modifying the main sqlite DB (com.plexapp.plugins.library.db) directly but the collection tag changes don't show up in the official Plex web interface.

&nbsp;

Is there an API that I need to call to tell Plex to flush its cache or am I going about this the wrong way altogether?

&nbsp;

App is here: [https://github.com/midwire/plexasaurus](https://github.com/midwire/plexasaurus)

&nbsp;

Thanks for any help.

Cheers,

&nbsp;

&nbsp;

![post-168377-0-24002600-1417033419.png|690x418](upload://blQUVLjh8ETJJxUZOdfQK8uK03i.png)

---

<div class="post-metadata">

**Author:** ![ccarvell-plex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ccarvell-plex/32/12704_2.png) [@ccarvell-plex](https://forums.plex.tv/u/ccarvell-plex)\
**Post date:** [November 30, 2014, 2:02am UTC](https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232/2 "2014-11-30T02:02:53Z")

</div>

I had the same issue. &nbsp;I found that I had to use the web interface (api) to get it to work correctly. &nbsp;In reality it made it sooooo much easier as I didn't need to understand the db at all.

I am working on a powershell script to pull the tags from imdb and insert into the collection for each movie. &nbsp;It is pretty slick and requires not a lot of code on my part.

Here is an example that I have (powershell using rest methods):

#Updates the metadata for plex,given that you give it keywords and a valid plex id

Function MovieUpdater([String[]]$keywords,[string]$plexid)

{

&nbsp; &nbsp; &nbsp;$inc=0

&nbsp; &nbsp; &nbsp;$urih = "[http://192.168.0.5:32400/library/metadata/](http://192.168.0.5:32400/library/metadata/)" + $plexid + "?" 

&nbsp; &nbsp; &nbsp;$varurl = ""

&nbsp; &nbsp; &nbsp;foreach($keyword in $keywords)

&nbsp; &nbsp; {&nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$newk = $keyword.replace(" ","%20")

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$sect = "collection%5B" + $inc + "%5D.tag.tag=$newk"

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($inc -ne 0){$sect = "&" + $sect}

&nbsp; &nbsp; &nbsp; &nbsp; $varurl = $varurl + $sect

&nbsp; &nbsp; &nbsp; &nbsp; $inc+=1

&nbsp; &nbsp; &nbsp;}

&nbsp; &nbsp; $varurl = $urih + $varurl

&nbsp; &nbsp; Invoke-RestMethod -Uri $varurl -method:Put

}

&nbsp;

Function get-fullmovielist()

{

&nbsp; &nbsp; &nbsp;$results=@{} &nbsp;#hashtable of results

&nbsp; &nbsp; &nbsp;$url = "[http://192.168.0.5:32400/library/sections/2/all?type=1&sort=titleSort:asc&X-Plex-Container-Start=0"](http://192.168.0.5:32400/library/sections/2/all?type=1&sort=titleSort:asc&X-Plex-Container-Start=0)

&nbsp; &nbsp; &nbsp;[xml]$RES = Invoke-RestMethod -Uri $url -method:get

&nbsp; &nbsp; &nbsp;foreach ($node in $res.mediacontainer.childnodes)

&nbsp; &nbsp; &nbsp;{

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $plexid = $node.ratingkey

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($plexid -ne $null -and $plexid -ne "")

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$urlchk = "[http://192.168.0.5:32400/library/metadata/](http://192.168.0.5:32400/library/metadata/)" + $plexid + "? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkFiles=1&includeExtras=1&includeRelated=1&includeRelatedCount=0" 

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[xml]$details = Invoke-RestMethod -Uri $urlchk -Method:Get

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($details -ne $null)

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$results.ADD($plexid,$details.MediaContainer.ChildNodes[1])

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp;}

&nbsp; &nbsp; &nbsp;return $results

}

&nbsp;

Some of the code above reads in a file that has words not to use in collections - for example: "newspaper, iron, man holding gun" etc.

&nbsp;

Cade

---

<div class="post-metadata">

**Author:** ![TotallyJuvenile](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/totallyjuvenile/32/86924_2.png) [@TotallyJuvenile](https://forums.plex.tv/u/TotallyJuvenile)\
**Post date:** [August 25, 2016, 5:13am UTC](https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232/3 "2016-08-25T05:13:40Z")

</div>

Where is the bundle file for this app. This sounds amazing. Sadly, the box for “Get Collection Info from” was selected on one of my agents. And it tagged everything with a weird collection tag. Sadly, those tags don’t even show up when I hit the edit on a specific title. I need to clear them.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 3:40am UTC](https://forums.plex.tv/t/plexasaurus-collection-tag-manager/84232/4 "2019-12-21T03:40:52Z")

</div>

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