Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrazione windows -->> Debian #5

Open
Pava1955 opened this issue Jun 6, 2023 · 8 comments
Open

Migrazione windows -->> Debian #5

Pava1955 opened this issue Jun 6, 2023 · 8 comments

Comments

@Pava1955
Copy link

Pava1955 commented Jun 6, 2023

Carissimo MMMZZZZ, sto configurando e utilizzando l'applicazione di migrazione che hai reso disponibile.
Ho una installazione su Win 10 (ben configurata) e vorrei spostarla su una macchina con Debian 11.
Dopo la configurazione delle path e tutto il resto il programma nella esecuzione con il CMD Shell mi restituisce i seguenti errori:

Traceback (most recent call last):
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migratorMio.py", line 1326, in
update_file_dates()
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migratorMio.py", line 1257, in update_file_dates
date_modified_ns = jf_date_str_to_python_ns(date_modified)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migratorMio.py", line 1179, in jf_date_str_to_python_ns
t = int(datetime.datetime.fromisoformat(s).timestamp())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid isoformat string: '0001-01-01 00:00:00Z+01:00'

Hai qualche idea o suggerimento ?
Grazie per la tua cortesia.
Claudio

@MMMZZZZ
Copy link
Owner

MMMZZZZ commented Jun 6, 2023

Hi @Pava1955,

I'm not fluent in your language and had to use a translator. Please consider replying in English.
I tried reproducing your error, but the failing string works perfectly fine for me (I copy-pasted the "invalid" string from your message). I tested both python 3.9.12 and 3.10.6.
Which python version are you using?

Kind regards,
Max

@Pava1955
Copy link
Author

Pava1955 commented Jun 7, 2023

Hi Massimo and thanks for the quick reply.
I was using Python version 3.11.4.
Now I have installed the one you indicated (3.10.6) and the error is as follows:

Current job from todo_list: I:\Shuttle_Debian\Jellyfin_Server_Originale\Server\data\playback_reporting.db
No entry for this (presumed) path: /var/lib/jellyfin/data/playback_reporting.db
Updating Item IDs in database...
Updating ItemId IDs in table PlaybackActivity...
Traceback (most recent call last):
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migrator_07062023.py", line 1326, in
process_files(
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migrator_07062023.py", line 1019, in process_files
process_func(
File "C:\Users\claud\Desktop\Jellyfin-Migrator\jellyfin_migrator_07062023.py", line 1061, in update_db_table_ids
rows = [r for r in cur.execute(f"SELECT DISTINCT {column} from {table}")]
sqlite3.OperationalError: no such table: PlaybackActivity

actually I don't have the "playback_reporting.db" library in the data
how can i proceed?
Naturally I modified your application by inserting the paths of my knowledge.
Thank you again

@MMMZZZZ
Copy link
Owner

MMMZZZZ commented Jun 8, 2023

Hello again,

Interesting to know that Python 3.11 might break that date function. Will check that.
The issue you're having right now is because you don't have the Playback Reporting plugin installed. Just remove these lines and that error should disappear:

{
"source": source_root / "data/playback_reporting.db",
"target": "auto-existing", # If you used "auto" in todo_list_paths, leave this on "auto-existing". Otherwise specify same path.
"replacements": {"oldids": "newids"}, # Will be auto-generated during the migration.
"tables": {
"PlaybackActivity": {
"str": [],
"str-dash": [],
"ancestor-str": [
"ItemId",
],
"ancestor-str-dash": [],
"bin": [],
},
},
},

Kind regards,
Max

@Pava1955
Copy link
Author

Pava1955 commented Jun 8, 2023

Hello Mass, I have made the recommended update and now the procedure is completed (I would like to migrate from Win 10 to Debian 11).
Checking the copied folders I verified some inaccuracies: for example the folder "\var\lib\jellyfin\metadata\library\00" contains some subfolders that are not present in the original path (in my case "C:\ProgramData\Jellyfin\Server \metadata\library\00") !

Where am I wrong?? Can I send you some data to get your valuable suggestion? Thanks again !

@Pava1955
Copy link
Author

Hi Max, did you get to see my request?
I can't understand why some directories are created which are not present in the original database.
I updated the "path_replacements" as follows:
for media files
"V:\Home Video": "/media/DataJellyfin/Video/Home Video",
...
...
while the operational files
"C:\ProgramData\Jellyfin\Server\config": "/etc/jellyfin", "C:\ProgramData\Jellyfin\Server\cache": "/var/cache/jellyfin",
"C:\ProgramData\Jellyfin\Server\log": "/var/log/jellyfin", "C:\ProgramData\Jellyfin\Server": "/var/lib/jellyfin",
"C:\ProgramData\Jellyfin\Server\transcodes": "/var/lib/jellyfin/transcodes",
"C:\Program Files\Jellyfin\Server\ffmpeg.exe": "usr/lib/jellyfin-ffmpeg/ffmpeg",
"C:\ffmpeg\bin\ffmpeg.exe": "usr/lib/jellyfin-ffmpeg/ffmpeg",
"%AppDataPath%": "%AppDataPath%",
"%MetadataPath%": "/media/DataJellyfi",
For the fs_path_replacements (I'm migrating to Debian and NOT Docker):
"log_no_warnings": False,
"target_path_slash": "/",
Do you think I did something wrong in the definition of the replacements??
Thanks and see you soon

@MMMZZZZ
Copy link
Owner

MMMZZZZ commented Jun 21, 2023

Hi @Pava1955,

If I'm not misunderstanding you, this is to be expected. Quote from the Technical Documentation of the Readme:

Internally, Jellyfin identifies files, folders, ... by a unique 32 byte ID. [...] The ID is calculated as [hash] of the type of the object as well as its file path. So to maintain a proper database, the IDs must be recalculated and updated wherever they occur.
[The IDs] also occur in the metadata file paths (among others). Meaning, the script not only checks and updates all the files but also their locations if an ID is detected in their file paths.

The more important part is that the metadata folder itself (and the other folders like config, ...) end up where they should be.

Kind regards,
Max

@brendanmatkin
Copy link

brendanmatkin commented Sep 7, 2023

@MMMZZZZ hey just as an aside regarding the datetime thing -

Using Python 3.11.2, if you get rid of the 'Z' (zulu) timezone marker then datetime.datetime.fromisoformat(s) works.

I think this is because the 'Z' and the time offset are equivalent, where Z = zulu = GMT = +00:00. I guess earlier versions of python didn't care about the redundancy but newer versions fixed that. I think including both is actually not a valid ISO8601 timestamp.

e.g.

import datetime

# this with Z AND +00:00 is not OK
>>> s = "0001-01-01 00:00:00Z+00:00"
>>> time = datetime.datetime.fromisoformat(s)
>>> print(time)
ValueError: Invalid isoformat string: '0001-01-01 00:00:00Z+00:00'

# this is ok (No "Z", only timezone offset)
>>> s = "0001-01-01 00:00:00+00:00"
>>> time = datetime.datetime.fromisoformat(s)
>>> print(time)
0001-01-01 00:00:00+00:00

# this is also ok (only "Z" with no timezone offset)
>>> s = "0001-01-01 00:00:00Z"
>>> time = datetime.datetime.fromisoformat(s)
>>> print(time)
0001-01-01 00:00:00+00:00

EDIT: p.s. looking in my library.db, all of the dates have Z at the end. Do you know if this is always true for Jellyfin? If so, then the "+00:00" on line 1171 can probably be removed and all will be well. Otherwise I suppose we check each time string to see if it ends in Z and if not, add +00:00?

@Pava1955
Copy link
Author

Pava1955 commented Sep 7, 2023

Grazie !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants