-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipepipe-to-newpipe.py
executable file
·41 lines (29 loc) · 1.15 KB
/
pipepipe-to-newpipe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import os
import sqlite3
import zipfile
# Specify the path to your zip file
zip_file_path = 'PipePipe.zip'
# Open the zip file and extract contents
with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
zip_ref.extractall(os.path.dirname(zip_file_path))
# Connect to the SQLite database
connection = sqlite3.connect('newpipe.db')
cursor = connection.cursor()
# Rename the column display_index TO is_thumbnail_permanent
cursor.execute('ALTER TABLE playlists RENAME COLUMN display_index TO is_thumbnail_permanent')
# Update all values in the renamed column to 0
cursor.execute('UPDATE playlists SET is_thumbnail_permanent = 0')
# Delete the column display_index
cursor.execute('ALTER TABLE remote_playlists DROP COLUMN display_index')
# Commit the changes
connection.commit()
# Close the connection
connection.close()
# Create a ZipFile object in write mode
with zipfile.ZipFile('NewPipe.zip', 'w') as zip_ref:
zip_ref.write('newpipe.db', arcname=os.path.basename('newpipe.db'))
zip_ref.write('newpipe.settings', arcname=os.path.basename('newpipe.settings'))
# Remove extracted files
os.remove('newpipe.db')
os.remove('newpipe.settings')