# Export library to text/html format?

**URL:** <https://forums.plex.tv/t/export-library-to-text-html-format/790>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [December 30, 2008, 8:12am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790 "2008-12-30T08:12:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joche](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@Joche](https://forums.plex.tv/u/Joche)\
**Post date:** [December 30, 2008, 8:12am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/1 "2008-12-30T08:12:10Z")

</div>

Is it possible to get a plain list of all media stored in the library. It would be good to bring on sales etc to not double-but things which I tend to do.  
  
  
  
  
  
I haven’t seen such a feature so perhaps this post should be moved to the feature request area.

---

<div class="post-metadata">

**Author:** ![jam](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jam/32/186050_2.png) [@jam](https://forums.plex.tv/u/jam)\
**Post date:** [December 30, 2008, 1:34pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/2 "2008-12-30T13:34:47Z")

</div>

No, it’s not possible. I think you can export to XML but that’s it. I suppose you could use some other reporting tool on the SQLite databases, but apart from that I don’t have any ideas, sorry. 🙂 It probably would count as a feature request, but since we’re not extending the current library at all I doubt you’ll see it added any time soon.

---

<div class="post-metadata">

**Author:** ![Joche](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@Joche](https://forums.plex.tv/u/Joche)\
**Post date:** [December 30, 2008, 5:39pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/3 "2008-12-30T17:39:52Z")

</div>

> [@](#):
>
> No, it’s not possible. I think you can export to XML but that’s it. I suppose you could use some other reporting tool on the SQLite databases, but apart from that I don’t have any ideas, sorry. 🙂 It probably would count as a feature request, but since we’re not extending the current library at all I doubt you’ll see it added any time soon.

  
  
  
Makes sense. I guess writing an XSL matching the XML would do the stuff for me. I'll see what I can do.

---

<div class="post-metadata">

**Author:** ![gauvins](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@gauvins](https://forums.plex.tv/u/gauvins)\
**Post date:** [December 30, 2008, 7:38pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/4 "2008-12-30T19:38:29Z")

</div>

> [@](#):
>
> Makes sense. I guess writing an XSL matching the XML would do the stuff for me. I’ll see what I can do.

  
  
Maybe you want to look at this applescript.  
  
[codebox]-- requires SQLiteAddOn (http://www.sqlabs.net/sqliteaddons.php) doesn't require registration in our case  
-- will iterate the DB to get the titles from the movies table and put in a TextEdit document (that can be edited/saved)  
-- EDIT 6 LINES BELOW TO THE PROPER USER NAME  
  
property queryRef : 0  
property s : ""  
  
-- SET THE PATH TO THE DB INTO YOUR DESKTOP  
set dbName to "/Users/USERNAME/Library/Application Support/Plex/userdata/Database/MyVideos34.db"  
  
-- OPEN your sqlite 3 database  
SQLiteOpen dbName  
-- EXECUTE QUERY, result is an array  
set queryRef to SQLiteSelect dbName query "SELECT count(idMovie) FROM movie"  
set myValue to SQLiteGetRow queryRef row 1  
set numberOfMovies to item 1 of myValue  
-- FREE QUERY  
  
SQLiteFree queryRef  
  
set myMoviesList to ""  
repeat with myrecord from 0 to (numberOfMovies - 1)  
 set queryRef to SQLiteSelect dbName query "SELECT c00 FROM movie LIMIT " & myrecord & " ,1"  
 set myValue to SQLiteGetRow queryRef row 1  
 set myResult to item 1 of myValue  
 SQLiteFree queryRef  
 set myMoviesList to myMoviesList & myResult & return  
  
end repeat  
SQLiteClose dbName  
  
  
tell application "TextEdit"  
 activate  
 make new document  
 set text of document 1 to myMoviesList as text  
end tell  
[/codebox]

---

<div class="post-metadata">

**Author:** ![Wacky](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@Wacky](https://forums.plex.tv/u/Wacky)\
**Post date:** [June 28, 2009, 8:40pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/5 "2009-06-28T20:40:34Z")

</div>

> [@](#):
>
> Maybe you want to look at this applescript.  
>   
>   
>   
> [codebox]-- requires SQLiteAddOn ([SQLabs: SQLite database management tools](http://www.sqlabs.net/sqliteaddons.php)) doesn’t require registration in our case  
>   
> – will iterate the DB to get the titles from the movies table and put in a TextEdit document (that can be edited/saved)  
>   
> [/codebox]

  
  
  
Is someone able to write a example applescript without using a 3rd party addon?  
The link in the script to download SQLiteAddOn is dead, and at the new site it is gone.  
Would be nice to have such a applescript which runs without dependencies.  
  
Erwin

---

<div class="post-metadata">

**Author:** ![meulemaster](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@meulemaster](https://forums.plex.tv/u/meulemaster)\
**Post date:** [August 19, 2009, 9:23am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/6 "2009-08-19T09:23:30Z")

</div>

Any update on this?  
  
  
  
I would also like to have a text document of the movies in my “Movies” section and my “watch videos” section. Right now I am dealing with movies showing up in my videos section but not in my movies… with 800+ movies I am having a hard time trying to figure out which are missing…  
  
  
  
I would live it if this feature could be added!  
  
  
  
Besides that I love plex more than any other program i have ever seen!

---

<div class="post-metadata">

**Author:** ![ickyfehmleh](https://avatars.discourse-cdn.com/v4/letter/i/b77776/32.png) [@ickyfehmleh](https://forums.plex.tv/u/ickyfehmleh)\
**Post date:** [August 30, 2009, 4:36pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/7 "2009-08-30T16:36:39Z")

</div>

> [@](#):
>
> Any update on this?  
>   
>   
>   
> I would also like to have a text document of the movies in my “Movies” section and my “watch videos” section. Right now I am dealing with movies showing up in my videos section but not in my movies… with 800+ movies I am having a hard time trying to figure out which are missing…  
>   
>   
>   
> I would live it if this feature could be added!  
>   
>   
>   
> Besides that I love plex more than any other program i have ever seen!

  
  
I could whip something up in python using templates I guess, is there still a demand for this?

---

<div class="post-metadata">

**Author:** ![CyberQuark](https://avatars.discourse-cdn.com/v4/letter/c/96bed5/32.png) [@CyberQuark](https://forums.plex.tv/u/CyberQuark)\
**Post date:** [September 2, 2009, 1:49am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/8 "2009-09-02T01:49:35Z")

</div>

> [@](#):
>
> I could whip something up in python using templates I guess, is there still a demand for this?

  
I have been trying to figure out a way to get a text export also, so I'd appreciate a solution. Users often keep a database of their movies, so exporting from Plex would be desirable.  
  
In addition, the ability to export artwork would also be nice.

---

<div class="post-metadata">

**Author:** ![zoara](https://avatars.discourse-cdn.com/v4/letter/z/eada6e/32.png) [@zoara](https://forums.plex.tv/u/zoara)\
**Post date:** [September 11, 2009, 3:08pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/9 "2009-09-11T15:08:30Z")

</div>

I’m partway through writing a script that does exactly this. At the moment, all that it does is list the movies and the TV shows; I still need to add functionality to list which seasons (and how many episodes per season) and also to deal with non-ASCII characters in the names.  
  
  
  
I can post it now if people are impatient, or I can post an updated version in a few days when it’s a bit more polished.

---

<div class="post-metadata">

**Author:** ![zoara](https://avatars.discourse-cdn.com/v4/letter/z/eada6e/32.png) [@zoara](https://forums.plex.tv/u/zoara)\
**Post date:** [September 13, 2009, 11:25am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/10 "2009-09-13T11:25:13Z")

</div>

Okay, it’s done. A Plex exporter, cunningly called plexport, which exports your library to a plain text list.  
  
  
  
Unzip the attached into ~/Library/Application Support/Plex/scripts/ (~/Library means the library folder in your home folder). Be sure that the folder is included - so you end up with ~/Library/Application Support/Plex/scripts/plexport/default.py  
  
  
  
You can now use it by going to Plex’s scripts. On the standard (MediaStream) skin, you go to “Change your Preferences”, hit right, and select “Scripts” from the menu; in the Aeon skin, just select “Scripts” from the main menu. Then hit “plexport”  
  
  
  
It will run for a few moments (it might be quite a few moments on a large library, so have patience!) and you’ll then find a file called plexport.txt on your desktop which contains a list of all movies and TV shows; for TV shows, the seasons and number of episodes for that season are also listed.  
  
  
  
This comes with one warning though - if by some coincidence you already have a file called plexport.txt on your desktop, it will overwrite it without asking. So just check before running it!  
  
  
  
Hope it’s as useful to others as it is to me.  
  
  
  
[EDIT] Updated version available, please scroll down! (how do I remove an attachment from my post?)

---

<div class="post-metadata">

**Author:** ![corelli](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@corelli](https://forums.plex.tv/u/corelli)\
**Post date:** [September 15, 2009, 4:09am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/11 "2009-09-15T04:09:10Z")

</div>

Wow - Thanks for the great script! It works like a charm and is exactly what I have been looking for. 😃

---

<div class="post-metadata">

**Author:** ![teh.hippy](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/teh.hippy/32/27_2.png) [@teh.hippy](https://forums.plex.tv/u/teh.hippy)\
**Post date:** [September 15, 2009, 10:02pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/12 "2009-09-15T22:02:28Z")

</div>

Awesome. Someone should sticky this. Very handy.

---

<div class="post-metadata">

**Author:** ![nerpissad](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nerpissad/32/438_2.png) [@nerpissad](https://forums.plex.tv/u/nerpissad)\
**Post date:** [September 15, 2009, 10:31pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/13 "2009-09-15T22:31:35Z")

</div>

thanks for this!!

---

<div class="post-metadata">

**Author:** ![zoara](https://avatars.discourse-cdn.com/v4/letter/z/eada6e/32.png) [@zoara](https://forums.plex.tv/u/zoara)\
**Post date:** [September 17, 2009, 9:44pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/14 "2009-09-17T21:44:04Z")

</div>

I’ve had a couple of bug reports.

1. It doesn’t order seasons correctly if you have seasons higher than ten (like The Simpsons). It uses a naive sorting order so you might get something like 1, 10, 12, 15, 2, 20, 3, 4.  
  
  
2. If you have a show with an apostrophe in it, then it never shows the seasons or episode counts for that show.  
  
  
  
Just thought I ought to make people aware of these; I will post a fix up here when I’ve put some time aside to have another mess about. I know what’s causing both issues, so that’s half the work done already 🙂  
  
  
  
I’m glad people are finding this useful!

---

<div class="post-metadata">

**Author:** ![zoara](https://avatars.discourse-cdn.com/v4/letter/z/eada6e/32.png) [@zoara](https://forums.plex.tv/u/zoara)\
**Post date:** [September 17, 2009, 9:46pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/15 "2009-09-17T21:46:47Z")

</div>

Just out of curiousity, is there much interest in me making this output HTML as well/instead of plain text?  
  
  
  
I’m not promising anything, just wondering…

---

<div class="post-metadata">

**Author:** ![pvigo](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pvigo/32/222_2.png) [@pvigo](https://forums.plex.tv/u/pvigo)\
**Post date:** [September 28, 2009, 4:44pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/16 "2009-09-28T16:44:22Z")

</div>

> [@](#):
>
> Just out of curiousity, is there much interest in me making this output HTML as well/instead of plain text?  
>   
> I'm not promising anything, just wondering...

  
  
  
Zoara, it would be just GREAT to have an HTML export of the library... if you can spare some time to try that would be terrific :P

---

<div class="post-metadata">

**Author:** ![zoara](https://avatars.discourse-cdn.com/v4/letter/z/eada6e/32.png) [@zoara](https://forums.plex.tv/u/zoara)\
**Post date:** [October 4, 2009, 2:12pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/17 "2009-10-04T14:12:53Z")

</div>

Quick bugfix update, attached at the bottom of this post.  
  
  
  
Seasons will now display in the correct order, for example it used to order them “1”, “10”, “2”.  
  
  
  
Shows containing an apostrophe now correctly display their seasons and episodes.  
  
  
  
Same installations instructions as detailed in the post above.

> [@](#):
>
> Zoara, it would be just GREAT to have an HTML export of the library... if you can spare some time to try that would be terrific :P

  
This is now planned. :)   
However, just as I was about to start working on it, a family member phoned up with computer problems, so it probably won't be done today. \<\_\< But it will happen, I promise!  
  
  
.

---

<div class="post-metadata">

**Author:** ![marklboris\_mac.com](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@marklboris\_mac.com](https://forums.plex.tv/u/marklboris_mac.com)\
**Post date:** [October 15, 2009, 4:38pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/18 "2009-10-15T16:38:11Z")

</div>

I too am very happy to see this script and I appreciate the work that went into it not knowing how to create scripts myself.   
  
I hate to ask this since I know it must take time but could you also include Music Videos in this script, thanks.

---

<div class="post-metadata">

**Author:** ![Januz](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Januz](https://forums.plex.tv/u/Januz)\
**Post date:** [November 29, 2009, 10:45am UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/19 "2009-11-29T10:45:54Z")

</div>

This is just great! Thanks!!!

---

<div class="post-metadata">

**Author:** ![creativo](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@creativo](https://forums.plex.tv/u/creativo)\
**Post date:** [February 10, 2010, 11:42pm UTC](https://forums.plex.tv/t/export-library-to-text-html-format/790/20 "2010-02-10T23:42:00Z")

</div>

Works great!! THX!

[Next page](https://forums.plex.tv/t/export-library-to-text-html-format/790.md?page=2)
