Page 1 of 1

paste new items in tag.dat

Posted: 25 May 2014 12:23
by calude
Hi
I have a set of folders/files that are mirrored between my laptop and desktop
They are tagged on the laptop
I would like to have both mirrors be tagged the same way
yesterday I tried to paste the relevant lines from the laptop's tag.dat to the desktop's tag.dat to no avail.
Tried different ways, in a text editor then reload without save, from the XY edit list interface, but I newer got the new lines imported hence showing the tags

any warnings, experience, help, ideas to try ?

Calude

Re: paste new items in tag.dat

Posted: 25 May 2014 12:43
by highend
Exact same paths for files?

E.g.:
Desktop - C:\Data\Folder\File1
Laptop - C:\Data\Folder\File1

Did you resort your tag.dat entries on the desktop's tag.dat after importing them?
It needs an ascending binary sort order... otherwise it won't work.

Re: paste new items in tag.dat

Posted: 25 May 2014 13:03
by calude
highend wrote:Exact same paths for files?

E.g.:
Desktop - C:\Data\Folder\File1
Laptop - C:\Data\Folder\File1
I had to adjust the beginning of the path in text editor like
Laptop - C:\Data\Folder\File1
Desktop - D:\Other\Data\Folder\File1
double checked, seemed right

highend wrote: Did you resort your tag.dat entries on the desktop's tag.dat after importing them?
It needs an ascending binary sort order... otherwise it won't work.
I saw some old forum post about this but couldnt find " "Database Clean Up..." in Configuration | Tags."
in the current xy version

XY didnt accept/read the "new" tag.dat and kept overwriting the "new" tag.dat with the unedited version

note: the new items contain completely new tags (not apearing in the taglist)

Cal

Re: paste new items in tag.dat

Posted: 25 May 2014 13:26
by highend

Code: Select all

    $newTags = input("Enter all tags that should be imported...", , , "m", , 800, 500);
    $tagFile = "<xydata>\tag.dat";
    $tagDB = readfile($tagFile);
    $header = gettoken($tagDB, 1, "Data:<crlf>");
    $existingTags = gettoken($tagDB, 2, "Data:<crlf>");
    $newTags = formatlist($existingTags . "<crlf>" . $newTags, "edc", "<crlf>");
    writefile($tagFile, $header . "Data:<crlf>" . $newTags);
Enter all tags from the laptop file into the text box. Hit OK. Quit XY (but ofc you have to DISABLE "General - Startup & Exit - [ ] Save settings on exit FIRST)!

Re: paste new items in tag.dat

Posted: 25 May 2014 13:49
by calude
wow thanks :appl: :D

before I try this at my office
is the path correction included here or should it been done before the script does its magic

reread your post I guess the path has already been corrected


Cal

Re: paste new items in tag.dat

Posted: 25 May 2014 14:48
by highend
path correction? sorry, I don't know which folders you are mirroring so you have to code that yourself.

Re: paste new items in tag.dat

Posted: 25 May 2014 15:08
by calude
I just tried your script
no joy yet

the new items got imported to tag.dat fine but the items dont show up in XY
whether in the tag column or in list management window

I compared both tag.dat formats: the laptop one has 2 "|" less than the desktop tag.dat

desktop: (created in desktop for compare)
D:\MUSIC PDF\cours de guitare\Débutants\Accords_a_4_sons.pdf|0|Solo||||||
laptop:
D:\MUSIC PDF\cours de guitare\Débutants\Accords_a_4_sons.pdf|0|exercice, rythm, technique, theory||||

looks like a XY bug...

Cal

Re: paste new items in tag.dat

Posted: 25 May 2014 15:10
by calude
highend wrote:path correction? sorry, I don't know which folders you are mirroring so you have to code that yourself.
yes indeed, sorry this post was useless
cal

Re: paste new items in tag.dat

Posted: 25 May 2014 15:25
by highend
This is no bug.
Tags on the laptop were created by an older XY version. That's all.

Why your entries don't show up?

Give REAL examples.

Two lines (files) from the laptop tag.dat. List them.

The same two lines after importing them on desktop (after they got saved to the tag.dat) file AND a screenshot from XY for these two files in (I want to see the full path). Again (for the file entries): List them.

Re: paste new items in tag.dat

Posted: 25 May 2014 15:51
by calude
highend wrote:This is no bug.
Tags on the laptop were created by an older XY version. That's all.
yes
Saved tag.dat this upgraded the DB

everything worked nicely from there

the new tags are alive and kicking in my desktop computer

thanks a lot

next beers are on me :beer: :beer: :beer: :beer: :appl:

Calude

Re: paste new items in tag.dat

Posted: 25 May 2014 16:45
by highend
Fine :)

and ... thank's for the beers! :beer: :beer: :beer: