NikGapps 3.31__tar.gz → 3.32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/NikGappsManager.py +23 -0
  2. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/Assets.py +4 -20
  3. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/appsets.json +6 -0
  4. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/packages.json +8 -0
  5. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/Library.py +28 -0
  6. {nikgapps-3.31 → nikgapps-3.32/NikGapps.egg-info}/PKG-INFO +1 -1
  7. {nikgapps-3.31 → nikgapps-3.32}/NikGapps.egg-info/SOURCES.txt +1 -4
  8. {nikgapps-3.31/NikGapps.egg-info → nikgapps-3.32}/PKG-INFO +1 -1
  9. {nikgapps-3.31 → nikgapps-3.32}/setup.py +1 -1
  10. nikgapps-3.31/NikGapps/helper/upload/CmdUpload.py +0 -169
  11. nikgapps-3.31/NikGapps/helper/upload/GoFileUpload.py +0 -56
  12. nikgapps-3.31/NikGapps/helper/upload/__init__.py +0 -0
  13. {nikgapps-3.31 → nikgapps-3.32}/LICENSE +0 -0
  14. {nikgapps-3.31 → nikgapps-3.32}/MANIFEST.in +0 -0
  15. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/__init__.py +0 -0
  16. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/Build.py +0 -0
  17. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/NikGappsOverlays.py +0 -0
  18. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/PackageConstants.py +0 -0
  19. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/Release.py +0 -0
  20. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build/__init__.py +0 -0
  21. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/build_config.py +0 -0
  22. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/cache.py +0 -0
  23. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/config/NikGappsConfig.py +0 -0
  24. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/config/__init__.py +0 -0
  25. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/config_upload.py +0 -0
  26. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/copy_repos.py +0 -0
  27. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/AppSet.py +0 -0
  28. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/Args.py +0 -0
  29. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/Config.py +0 -0
  30. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/ConfigObj.py +0 -0
  31. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/Package.py +0 -0
  32. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/__init__.py +0 -0
  33. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/addon.sh +0 -0
  34. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/changelogs.yaml +0 -0
  35. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/config_versions.json +0 -0
  36. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/customize.sh +0 -0
  37. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/debloater.config +0 -0
  38. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/functions.sh +0 -0
  39. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/gofile.sh +0 -0
  40. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/header.sh +0 -0
  41. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/installer.sh +0 -0
  42. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/magisk-update-binary.sh +0 -0
  43. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/module.prop +0 -0
  44. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/mount.sh +0 -0
  45. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/mtg_mount.sh +0 -0
  46. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/nikgapps.config +0 -0
  47. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/nikgapps_functions.sh +0 -0
  48. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/uninstaller.sh +0 -0
  49. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/assets/unmount.sh +0 -0
  50. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/compression/CompOps.py +0 -0
  51. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/compression/Export.py +0 -0
  52. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/compression/__init__.py +0 -0
  53. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/git/TestGit.py +0 -0
  54. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/git/__init__.py +0 -0
  55. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/ApkMetaInfo.py +0 -0
  56. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/Bool.py +0 -0
  57. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/Manifest.py +0 -0
  58. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/Overlay.py +0 -0
  59. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/Resources.py +0 -0
  60. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/String.py +0 -0
  61. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/StringArray.py +0 -0
  62. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/helper/overlay/__init__.py +0 -0
  63. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/main.py +0 -0
  64. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/overlay_control.py +0 -0
  65. {nikgapps-3.31 → nikgapps-3.32}/NikGapps/test.py +0 -0
  66. {nikgapps-3.31 → nikgapps-3.32}/NikGapps.egg-info/dependency_links.txt +0 -0
  67. {nikgapps-3.31 → nikgapps-3.32}/NikGapps.egg-info/entry_points.txt +0 -0
  68. {nikgapps-3.31 → nikgapps-3.32}/NikGapps.egg-info/requires.txt +0 -0
  69. {nikgapps-3.31 → nikgapps-3.32}/NikGapps.egg-info/top_level.txt +0 -0
  70. {nikgapps-3.31 → nikgapps-3.32}/README.md +0 -0
  71. {nikgapps-3.31 → nikgapps-3.32}/setup.cfg +0 -0
@@ -303,6 +303,27 @@ class NikGappsManager:
303
303
  "resources": Library.get_device_health_services_resources()
304
304
  }
305
305
  ],
306
+ "com.google.android.apps.nbu.files": [
307
+ {
308
+ "package_title": "GoogleFiles",
309
+ "package_name": "com.nikgapps.overlay.files",
310
+ "resources": Library.get_google_files_resources()
311
+ }
312
+ ],
313
+ "com.google.android.apps.wallpaper": [
314
+ {
315
+ "package_title": "GoogleWallpaper",
316
+ "package_name": "com.nikgapps.overlay.wallpaper",
317
+ "resources": Library.get_google_wallpaper_resources()
318
+ }
319
+ ],
320
+ "com.google.android.apps.work.oobconfig": [
321
+ {
322
+ "package_title": "DeviceSetup",
323
+ "package_name": "com.nikgapps.overlay.partnersetup",
324
+ "resources": Library.get_google_partner_setup_resources()
325
+ }
326
+ ],
306
327
  }
307
328
  return [Overlay(overlay["package_title"], overlay["package_name"], self.android_version, overlay["resources"])
308
329
  for overlay
@@ -402,6 +423,8 @@ class NikGappsManager:
402
423
  # pixel_launcher_packages.append("CinematicEffect")
403
424
  pixel_launcher_packages.append("EmojiWallpaper")
404
425
  pixel_launcher_packages.append("PixelWeather")
426
+ if float(self.android_version) >= 15:
427
+ pixel_launcher_packages.append("AICore")
405
428
  pixel_specifics = self.create_appset_list_from_packages(pixel_launcher_packages)
406
429
  stock_packages = [
407
430
  "PlayGames",
@@ -1,12 +1,9 @@
1
1
  from pathlib import Path
2
2
  from importlib import resources
3
3
 
4
- from nikassets.helper.Assets import Assets as A
4
+ from niklibrary.helper.Assets import Assets as A
5
5
  from niklibrary.helper.F import F
6
-
7
- from niklibrary.helper.Statics import Statics
8
6
  import os.path
9
- import platform
10
7
 
11
8
  from niklibrary.json.Json import Json
12
9
 
@@ -24,30 +21,17 @@ class Assets:
24
21
  assets_folder = str(folders)
25
22
  break
26
23
  cwd = assets_folder + os.path.sep
27
- system_name = platform.system()
24
+ system_name = A.system_name
28
25
  apksigner_path = A.get("apksigner.jar")
29
26
  apktool_path = A.get("apktool_2.10.0.jar")
30
27
  key_path = A.get("cert.pk8")
31
28
  cert_path = A.get("cert.x509.pem")
32
29
  private_key_pem = A.get("private_key.pem")
33
- if system_name == "Windows":
34
- aapt_path = os.path.join(A.assets_folder, 'bin', system_name, 'aapt2.exe')
35
- adb_path = os.path.join(A.assets_folder, 'bin', system_name, 'adb.exe')
36
- elif system_name == "Linux":
37
- aapt_path = os.path.join(A.assets_folder, 'bin', system_name, 'aapt2')
38
- adb_path = "adb"
39
- elif system_name == "Darwin":
40
- aapt_path = os.path.join(A.assets_folder, 'bin', system_name, 'aapt2')
41
- if not F.file_exists(aapt_path):
42
- aapt_path = Statics.find_latest_aapt()
43
- adb_path = "adb"
44
- else:
45
- aapt_path = "adb"
46
- adb_path = "aapt2"
30
+ aapt_path = A.aapt_path
31
+ adb_path = A.adb_path
47
32
  addon_path = cwd + "addon.sh"
48
33
  header_path = cwd + "header.sh"
49
34
  functions_path = cwd + "functions.sh"
50
- gofile_path = cwd + "gofile.sh"
51
35
  busybox = A.get("busybox")
52
36
  file_sizes_path = cwd + "file_size.txt"
53
37
  mount_path = cwd + "mount.sh"
@@ -406,6 +406,12 @@
406
406
  "EmojiWallpaper",
407
407
  "PixelWeather"
408
408
  ]
409
+ },
410
+ {
411
+ "min_version": 15,
412
+ "packages": [
413
+ "AICore"
414
+ ]
409
415
  }
410
416
  ],
411
417
  "PlayGames": [
@@ -614,5 +614,13 @@
614
614
  "title": "YouTubeMusicPrebuilt",
615
615
  "type": "app"
616
616
  }
617
+ ],
618
+ "AICore": [
619
+ {
620
+ "package_name": "com.google.android.aicore",
621
+ "partition": "product",
622
+ "title": "AiCorePrebuilt",
623
+ "type": "priv-app"
624
+ }
617
625
  ]
618
626
  }
@@ -48,6 +48,8 @@ class Library:
48
48
  r.add(String('config_defaultDndAccessPackages', 'com.google.android.gms:com.google.android.apps.wellbeing',
49
49
  comment='Colon separated list of package names that should be granted DND access.'))
50
50
  r.add(StringArray('config_packagesExemptFromSuspension', ['com.google.android.apps.wellbeing']))
51
+ r.add(StringArray('config_quickSettingsAutoAdd', ['wind_down_first_time_setup:custom(com.google.android.apps.wellbeing/.screen.ui.GrayscaleTileService)',
52
+ 'focus_mode_first_time_setup:custom(com.google.android.apps.wellbeing/.focusmode.quicksettings.FocusModeTileService)']))
51
53
  return r
52
54
 
53
55
  @staticmethod
@@ -82,6 +84,10 @@ class Library:
82
84
  r.add(String('platform_number_verification_package', 'com.google.android.gms'))
83
85
  r.add(String('config_defaultQrCodeComponent',
84
86
  'com.google.android.gms/.mlkit.barcode.ui.PlatformBarcodeScanningActivityProxy'))
87
+ r.add(String('config_defaultCredentialManagerHybridService', 'com.google.android.gms/.auth.api.credentials.credman.service.RemoteService'))
88
+ r.add(String('config_remoteCopyPackage', 'com.google.android.gms/.nearby.sharing.RemoteCopyShareSheetActivity'))
89
+ r.add(String('config_systemCallStreaming', 'com.google.android.gms'))
90
+ r.add(String('config_oemCredentialManagerDialogComponent', 'com.google.android.gms/.identitycredentials.ui.CredentialChooserActivity'))
85
91
  r.add(Bool('config_enableAutoPowerModes', True))
86
92
  r.add(Bool('config_enableNetworkLocationOverlay', True))
87
93
  r.add(Bool('config_enableFusedLocationOverlay', True))
@@ -460,3 +466,25 @@ class Library:
460
466
  r.add(String('config_defaultWallpaperEffectsGenerationService',
461
467
  'com.google.android.as/com.google.android.apps.miphone.aiai.app.wallpapereffects.AiAiWallpaperEffectsGenerationService'))
462
468
  return r
469
+
470
+ @staticmethod
471
+ def get_google_files_resources():
472
+ r = Resources()
473
+ r.add(String('config_systemFilePicker', 'com.google.android.apps.nbu.files'))
474
+ r.add(String('config_sceenshotWorkProfileFilesApp', 'com.google.android.apps.nbu.files/com.google.android.apps.nbu.files.home.HomeActivity'))
475
+ return r
476
+
477
+ @staticmethod
478
+ def get_google_wallpaper_resources():
479
+ r = Resources()
480
+ r.add(String('config_wallpaper_picker_package', 'com.google.android.apps.wallpaper'))
481
+ r.add(String('config_wallpaperCropperPackage', 'com.google.android.apps.wallpaper'))
482
+ r.add(String('config_wallpaper_picker_class', 'com.google.android.apps.wallpaper.picker.CategoryPickerActivity'))
483
+ r.add(String('config_styles_and_wallpaper_picker_class', 'com.android.customization.picker.CustomizationPickerActivity'))
484
+ return r
485
+
486
+ @staticmethod
487
+ def get_google_partner_setup_resources():
488
+ r = Resources()
489
+ r.add(String('config_deviceProvisioningPackage', 'com.google.android.apps.work.oobconfig'))
490
+ return r
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NikGapps
3
- Version: 3.31
3
+ Version: 3.32
4
4
  Summary: A short description of your project
5
5
  Home-page: https://github.com/nikgapps/project
6
6
  Author: Nikhil Menghani
@@ -63,7 +63,4 @@ NikGapps/helper/overlay/Overlay.py
63
63
  NikGapps/helper/overlay/Resources.py
64
64
  NikGapps/helper/overlay/String.py
65
65
  NikGapps/helper/overlay/StringArray.py
66
- NikGapps/helper/overlay/__init__.py
67
- NikGapps/helper/upload/CmdUpload.py
68
- NikGapps/helper/upload/GoFileUpload.py
69
- NikGapps/helper/upload/__init__.py
66
+ NikGapps/helper/overlay/__init__.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NikGapps
3
- Version: 3.31
3
+ Version: 3.32
4
4
  Summary: A short description of your project
5
5
  Home-page: https://github.com/nikgapps/project
6
6
  Author: Nikhil Menghani
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="NikGapps",
5
- version="3.31",
5
+ version="3.32",
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  package_data={
@@ -1,169 +0,0 @@
1
- import os
2
- import platform
3
- import time
4
- from pathlib import Path
5
- import pexpect
6
- from niklibrary.helper.F import F
7
- from niklibrary.helper.P import P
8
- from niklibrary.helper.Statics import Statics
9
- from niklibrary.helper.T import T
10
- from niklibrary.web.TelegramApi import TelegramApi
11
-
12
-
13
- class CmdUpload:
14
-
15
- def __init__(self, android_version, release_type, upload_files, password=None):
16
- self.android_version_code = Statics.get_android_code(android_version)
17
- self.upload_files = upload_files
18
- self.host = "frs.sourceforge.net"
19
- self.username = "nikhilmenghani"
20
- self.password = os.environ.get('SF_PWD') if password is None else password
21
- self.release_dir = Statics.get_sourceforge_release_directory(release_type)
22
- self.release_date = T.get_london_date_time("%d-%b-%Y")
23
- self.child = None
24
- self.successful_connection = False
25
- if self.password is None or self.password.__eq__(""):
26
- self.password = ""
27
- self.sftp = None
28
- P.red("Password is not set, please set the password in environment variable SF_PWD")
29
- return
30
- self.connect_using_pexpect()
31
-
32
- def expect_password(self):
33
- self.child.sendline(str(self.password))
34
- print(f"Expecting Connected to {self.host} or sftp> or Password")
35
- return self.check_successful_connection()
36
-
37
- def check_successful_connection(self):
38
- status = self.child.expect([f"Connected to {self.host}", "sftp> ", "Password"])
39
- if status == 0 or status == 1:
40
- print("Connection was successful")
41
- return True
42
- return False
43
-
44
- def connect_using_pexpect(self):
45
- self.child = pexpect.spawn(f'sftp {self.username}@{self.host}')
46
- tried_twice = False
47
- print("Expecting Password")
48
- while True:
49
- i = self.child.expect(["Password", "yes/no", pexpect.TIMEOUT, pexpect.EOF], timeout=120)
50
- if i == 0: # Password
51
- print("Sending Password")
52
- self.successful_connection = self.expect_password()
53
- elif i == 1: # yes/no
54
- print("sending yes")
55
- self.child.sendline("yes")
56
- print("Expecting Password")
57
- self.child.expect("Password")
58
- self.successful_connection = self.expect_password()
59
- elif i == 2 or i == 3: # TIMEOUT or EOF
60
- if not tried_twice:
61
- print("Timeout has occurred, let's try one more time")
62
- # self.child.sendcontrol('c')
63
- self.close_connection()
64
- self.child = pexpect.spawn('sftp nikhilmenghani@frs.sourceforge.net')
65
- tried_twice = True
66
- else:
67
- print("Connection failed")
68
- break
69
- else: # other cases
70
- print("Connection failed")
71
- self.close_connection()
72
- try:
73
- self.child.interact()
74
- except BaseException as e:
75
- print("Exception while interacting: " + str(e))
76
- if self.successful_connection or i not in [0, 1, 2, 3]:
77
- break
78
-
79
- def navigate_to_directory(self, directory):
80
- self.child.expect('sftp>')
81
- self.child.sendline(f'cd {directory}')
82
-
83
- def create_directory_structure(self, remote_directory):
84
- # Split the directory path into components
85
- remote_directory = remote_directory.replace(f"{self.release_dir}/", '')
86
- directories = remote_directory.split('/')
87
- # cd to the root directory
88
- self.navigate_to_directory(self.release_dir)
89
- # Create each directory in the path separately
90
- for i in range(len(directories)):
91
- path = '/'.join(directories[:i + 1])
92
- print(f"Creating directory {self.release_dir}/{path}")
93
- self.child.expect('sftp>')
94
- self.child.sendline(f'mkdir {path}')
95
-
96
- def get_cd(self, file_type):
97
- folder_name = "Test"
98
- match file_type:
99
- case "gapps":
100
- folder_name = "NikGapps-" + self.android_version_code
101
- case "config":
102
- folder_name = "NikGapps-" + self.android_version_code
103
- return self.release_dir + "/" + folder_name
104
- case "addons":
105
- folder_name = "Addons-" + self.android_version_code
106
- case "debloater":
107
- folder_name = "Debloater"
108
- case _:
109
- print(file_type)
110
- print("Upload Dir: " + self.release_dir + "/" + folder_name)
111
- return self.release_dir + "/" + folder_name + "/" + self.release_date
112
-
113
- def upload_file(self, file_path, remote_path):
114
- self.child.sendline("put " + file_path + " " + remote_path)
115
- self.child.expect("Uploading")
116
- self.child.expect("100%", timeout=3600)
117
- self.child.expect("sftp>")
118
- time.sleep(1)
119
-
120
- def upload(self, file_name, telegram: TelegramApi = None, remote_directory=None):
121
- execution_status = False
122
- download_link = None
123
- file_size_mb = None
124
- if self.successful_connection:
125
- system_name = platform.system()
126
- file_size_kb = round(F.get_file_size(file_name, "KB"), 2)
127
- file_size_mb = round(F.get_file_size(file_name), 2)
128
- if telegram is not None:
129
- telegram.message(f"- The zip {file_size_mb} MB is uploading...")
130
- if system_name != "Windows" and self.upload_files:
131
- t = T()
132
- file_type = "gapps"
133
- if os.path.basename(file_name).__contains__("-Addon-"):
134
- file_type = "addons"
135
- elif os.path.basename(file_name).__contains__("Debloater"):
136
- file_type = "debloater"
137
-
138
- if remote_directory is None:
139
- remote_directory = self.get_cd(file_type)
140
-
141
- remote_filename = Path(file_name).name
142
- self.create_directory_structure(remote_directory)
143
- self.navigate_to_directory(remote_directory)
144
- self.upload_file(file_name, remote_filename)
145
- P.green(f'File uploaded successfully to {remote_directory}/{remote_filename}')
146
- download_link = Statics.get_download_link(file_name, remote_directory)
147
- P.magenta("Download Link: " + download_link)
148
- print("uploading file finished...")
149
- execution_status = True
150
- time_taken = t.taken(f"Total time taken to upload file with size {file_size_mb} MB ("
151
- f"{file_size_kb} Kb)")
152
- if execution_status:
153
- if telegram is not None:
154
- telegram.message(
155
- f"- The zip {file_size_mb} MB uploaded in {T.format_time(round(time_taken))}\n",
156
- replace_last_message=True)
157
- if download_link is not None:
158
- telegram.message(f"*Note:* Download link should start working in 10 minutes", escape_text=False,
159
- ur_link={f"Download": f"{download_link}"})
160
- else:
161
- P.red("System incompatible or upload disabled or connection failed!")
162
- else:
163
- P.red("Connection failed!")
164
- return execution_status, download_link, file_size_mb
165
-
166
- def close_connection(self):
167
- if not str(self.password).__eq__(""):
168
- self.child.sendline("bye")
169
- self.child.close()
@@ -1,56 +0,0 @@
1
- import platform
2
-
3
- from NikGapps.helper.Assets import Assets
4
- from niklibrary.helper.Cmd import Cmd
5
- from niklibrary.helper.F import F
6
- from niklibrary.helper.P import P
7
- from niklibrary.helper.T import T
8
- from niklibrary.web.TelegramApi import TelegramApi
9
-
10
-
11
- class GoFileUpload:
12
-
13
- @staticmethod
14
- def upload_file(file):
15
- cmd = Cmd()
16
- command = [f"{Assets.gofile_path}"] + [file]
17
- output = cmd.execute_cmd(command)
18
- print("Upload Log: " + str(output))
19
- for line in output:
20
- if line.startswith("https://gofile.io/"):
21
- return line
22
- return None
23
-
24
- @staticmethod
25
- def upload(file_name, telegram: TelegramApi = None):
26
- system_name = platform.system()
27
- execution_status = False
28
- download_link = None
29
- file_size_mb = None
30
- if telegram is not None:
31
- telegram.message("- The zip is uploading...")
32
- if system_name != "Windows":
33
- t = T()
34
- download_link = GoFileUpload.upload_file(file_name)
35
- P.magenta("Download Link: " + download_link)
36
- if download_link is None:
37
- P.red("Upload failed!")
38
- telegram.message("- Upload failed!")
39
- return execution_status
40
- print("uploading file finished...")
41
- execution_status = True
42
- file_size_kb = round(F.get_file_size(file_name, "KB"), 2)
43
- file_size_mb = round(F.get_file_size(file_name), 2)
44
- time_taken = t.taken(f"Total time taken to upload file with size {file_size_mb} MB ("
45
- f"{file_size_kb} Kb)")
46
- if execution_status:
47
- if telegram is not None:
48
- telegram.message(
49
- f"- The zip {file_size_mb} MB uploaded in {str(round(time_taken))} seconds\n",
50
- replace_last_message=True)
51
- if download_link is not None:
52
- telegram.message(f"*Note:* Download link should start working in 10 minutes", escape_text=False,
53
- ur_link={f"Download": f"{download_link}"})
54
- else:
55
- P.red("System incompatible or upload disabled or connection failed!")
56
- return execution_status, download_link, file_size_mb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes