Custom field to Tag field?

Any trouble you encounter with the Pedias, here's the place to ask for help.

Custom field to Tag field?

Postby DreamStatic » Sat Nov 29, 2008 1:58 pm

Many, many moons ago I made one of my Custom fields "Keywords", because I wanted to be able to tag my movies and the tag field didn't exist then, or I didn't know it existed. :) Either way, I now have 3700+ entries with random keywords in my Custom field. It works fine, but I hate wasting a custom field when one exists dedicated to its function. So is there an easy way to move all data in "Keywords (custom1) field to Tags?

Thanks so much for the info.
DreamStatic
Addicted to Bruji
Addicted to Bruji
 
Posts: 64
Joined: Tue May 30, 2006 4:57 pm

Re: Custom field to Tag field?

Postby Conor » Sun Nov 30, 2008 7:30 am

You have to use the program called Terminal in your Utilities folder to accomplish the move directly on the database file using SQL commands.

1. Quit DVDpedia
2. Navigate to your home folder ~/Library/Application Support/DVDpedia/Database.dvdpd and make a duplicate copy of that file as backup.
3. Open Terminal
4. Copy paste the following command one line at a time (update "custom1" to the correct custom field number):
Code: Select all
sqlite3 ~/Library/Application\ Support/DVDpedia/Database.dvdpd
update zEntry set zTags = zCustom1 WHERE ztags is NULL;
.exit

5. Launch DVDpedia and the custom field should have been copied to the tags field, where the tags where empty.
6. Use DVDpedia to select all the entries and use the multi-edit to blank out the custom field and recover it.

If you already have some tags in the tags field then the you need to run one more SQL command before the ".exit" command above. This second command would update those entries where tags already exist and merge the two fields:
Code: Select all
update zEntry set zTags = zTags || ', ' || zCustom1 WHERE zTags is not NULL;
User avatar
Conor
Top Dog
 
Posts: 4097
Joined: Sat Jul 03, 2004 12:58 pm

Re: Custom field to Tag field?

Postby DreamStatic » Sun Nov 30, 2008 12:41 pm

Worked like Magic. :) Just perfect.

As I said in my other post: viewtopic.php?f=7&t=2838

You continue to amaze me with the sharing of your time and knowledge. Thank you, Conor, very much! I appreciate you and Nora greatly.
DreamStatic
Addicted to Bruji
Addicted to Bruji
 
Posts: 64
Joined: Tue May 30, 2006 4:57 pm


Return to Support