Youtube-Comment-Export 0.1.0__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 (24) hide show
  1. youtube_comment_export-0.1.0/License +21 -0
  2. youtube_comment_export-0.1.0/PKG-INFO +103 -0
  3. youtube_comment_export-0.1.0/README.md +84 -0
  4. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/PKG-INFO +103 -0
  5. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/SOURCES.txt +23 -0
  6. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/dependency_links.txt +1 -0
  7. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/entry_points.txt +2 -0
  8. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/requires.txt +5 -0
  9. youtube_comment_export-0.1.0/Youtube_Comment_Export.egg-info/top_level.txt +1 -0
  10. youtube_comment_export-0.1.0/pyproject.toml +30 -0
  11. youtube_comment_export-0.1.0/setup.cfg +32 -0
  12. youtube_comment_export-0.1.0/ytComments/__init__.py +5 -0
  13. youtube_comment_export-0.1.0/ytComments/gui/__init__.py +19 -0
  14. youtube_comment_export-0.1.0/ytComments/gui/about.py +131 -0
  15. youtube_comment_export-0.1.0/ytComments/gui/app.py +97 -0
  16. youtube_comment_export-0.1.0/ytComments/gui/error.py +83 -0
  17. youtube_comment_export-0.1.0/ytComments/gui/main.py +170 -0
  18. youtube_comment_export-0.1.0/ytComments/gui/menu.py +26 -0
  19. youtube_comment_export-0.1.0/ytComments/gui/progressbar.py +101 -0
  20. youtube_comment_export-0.1.0/ytComments/gui/settings.py +186 -0
  21. youtube_comment_export-0.1.0/ytComments/gui/update.py +158 -0
  22. youtube_comment_export-0.1.0/ytComments/metadata.py +22 -0
  23. youtube_comment_export-0.1.0/ytComments/settingsManager.py +172 -0
  24. youtube_comment_export-0.1.0/ytComments/youtube.py +546 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Michaël AUGUSTE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: Youtube-Comment-Export
3
+ Version: 0.1.0
4
+ Summary: Export a YouTube channel Comments in a nice Excel format.
5
+ Home-page: https://github.com/Atem83/Youtube-Comment-Export
6
+ Author: Michaël AUGUSTE
7
+ License: MIT
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Description-Content-Type: text/markdown
12
+ License-File: License
13
+ Requires-Dist: yt_dlp
14
+ Requires-Dist: polars
15
+ Requires-Dist: xlsxwriter
16
+ Requires-Dist: colorama
17
+ Requires-Dist: PySide6
18
+ Dynamic: license-file
19
+
20
+ <h1 align="center">Youtube Comment Export</h1>
21
+
22
+ <h3 align="center">Export the comments of a YouTube channel in Excel files.</h3>
23
+
24
+ <div align="center">
25
+
26
+ [![PyPI](https://img.shields.io/pypi/v/Youtube-Comment-Export?style=flat)](https://pypi.org/project/Youtube-Comment-Export)
27
+ <a href="https://opensource.org/license/mit">![License](https://img.shields.io/badge/License-MIT-blue)</a>
28
+ <a href="https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip">![Download](https://img.shields.io/badge/Source_Code-Download-blue)</a>
29
+ ![LOC](https://tokei.rs/b1/github/Atem83/Youtube-Comment-Export?category=lines)
30
+
31
+ </div>
32
+
33
+ <div align="center">
34
+ <div style="display: flex; justify-content: space-around;">
35
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI light theme.png" alt="GUI Light Theme" style="width: 35%;">
36
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI dark theme.png" alt="GUI Dark Theme" style="width: 35%;">
37
+ </div>
38
+ </div>
39
+
40
+ <br>
41
+
42
+ <div align="center">
43
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI Settings.png" alt="GUI Settings" style="width: 35%;">
44
+ </div>
45
+
46
+ <h2 align="center"> Excel Main Sheet </h2>
47
+
48
+ <div align="center">
49
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel videos sheet.png" alt="Excel videos sheet" style="width: 100%;">
50
+ </div>
51
+
52
+ <h2 align="center"> Excel Comments Sheet </h2>
53
+
54
+ <div align="center">
55
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel comments sheet.png" alt="Excel comments sheet" style="width: 100%;">
56
+ </div>
57
+
58
+ <h2 align="center"> Features </h2>
59
+
60
+ - Download data from a YouTube channel
61
+ - Download comments from a YouTube channel
62
+ - Export the data and comments in Excel files in a nice format
63
+ - Light ou Dark theme according to your OS theme
64
+ - Import old saves, this way :
65
+ - you can keep a more precise date of the comments
66
+ - you can keep comments even if they have been deleted
67
+ - sadly, it will not be possible to save downloading time because all the comments needs to be downloaded again
68
+
69
+ <h2 align="center"> Installation </h2>
70
+
71
+ <div align="center">
72
+
73
+ ```
74
+ pip install Youtube-Comment-Export
75
+ ```
76
+
77
+ [<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/Atem83/Youtube-Comment-Export?&color=green&label=Source%20Code&logo=Python&logoColor=yellow&style=for-the-badge" width="300">](https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip)
78
+
79
+ </div>
80
+
81
+ <h2 align="center"> GUI Usage </h2>
82
+
83
+ ```python
84
+ import ytComments
85
+
86
+ app = ytComments.App()
87
+ app.run()
88
+ ```
89
+ <h2 align="center"> Python Usage </h2>
90
+
91
+ ```python
92
+ import ytComments
93
+
94
+ channel_url = 'https://www.youtube.com/@GabbPiano'
95
+ path_save1 = r'C:\Users\User\Desktop\Save File 1.xlsx'
96
+ path_save2 = r'C:\Users\User\Desktop\Save File 2.xlsx'
97
+ path_save = [path_save1, path_save2]
98
+
99
+ yt = ytComments.yt_manager(channel_url, old_save=path_save)
100
+ yt.import_excel() # Import the old save data
101
+ yt.export_excel() # Export the data in Excel files
102
+
103
+ ```
@@ -0,0 +1,84 @@
1
+ <h1 align="center">Youtube Comment Export</h1>
2
+
3
+ <h3 align="center">Export the comments of a YouTube channel in Excel files.</h3>
4
+
5
+ <div align="center">
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/Youtube-Comment-Export?style=flat)](https://pypi.org/project/Youtube-Comment-Export)
8
+ <a href="https://opensource.org/license/mit">![License](https://img.shields.io/badge/License-MIT-blue)</a>
9
+ <a href="https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip">![Download](https://img.shields.io/badge/Source_Code-Download-blue)</a>
10
+ ![LOC](https://tokei.rs/b1/github/Atem83/Youtube-Comment-Export?category=lines)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+ <div style="display: flex; justify-content: space-around;">
16
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI light theme.png" alt="GUI Light Theme" style="width: 35%;">
17
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI dark theme.png" alt="GUI Dark Theme" style="width: 35%;">
18
+ </div>
19
+ </div>
20
+
21
+ <br>
22
+
23
+ <div align="center">
24
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI Settings.png" alt="GUI Settings" style="width: 35%;">
25
+ </div>
26
+
27
+ <h2 align="center"> Excel Main Sheet </h2>
28
+
29
+ <div align="center">
30
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel videos sheet.png" alt="Excel videos sheet" style="width: 100%;">
31
+ </div>
32
+
33
+ <h2 align="center"> Excel Comments Sheet </h2>
34
+
35
+ <div align="center">
36
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel comments sheet.png" alt="Excel comments sheet" style="width: 100%;">
37
+ </div>
38
+
39
+ <h2 align="center"> Features </h2>
40
+
41
+ - Download data from a YouTube channel
42
+ - Download comments from a YouTube channel
43
+ - Export the data and comments in Excel files in a nice format
44
+ - Light ou Dark theme according to your OS theme
45
+ - Import old saves, this way :
46
+ - you can keep a more precise date of the comments
47
+ - you can keep comments even if they have been deleted
48
+ - sadly, it will not be possible to save downloading time because all the comments needs to be downloaded again
49
+
50
+ <h2 align="center"> Installation </h2>
51
+
52
+ <div align="center">
53
+
54
+ ```
55
+ pip install Youtube-Comment-Export
56
+ ```
57
+
58
+ [<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/Atem83/Youtube-Comment-Export?&color=green&label=Source%20Code&logo=Python&logoColor=yellow&style=for-the-badge" width="300">](https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip)
59
+
60
+ </div>
61
+
62
+ <h2 align="center"> GUI Usage </h2>
63
+
64
+ ```python
65
+ import ytComments
66
+
67
+ app = ytComments.App()
68
+ app.run()
69
+ ```
70
+ <h2 align="center"> Python Usage </h2>
71
+
72
+ ```python
73
+ import ytComments
74
+
75
+ channel_url = 'https://www.youtube.com/@GabbPiano'
76
+ path_save1 = r'C:\Users\User\Desktop\Save File 1.xlsx'
77
+ path_save2 = r'C:\Users\User\Desktop\Save File 2.xlsx'
78
+ path_save = [path_save1, path_save2]
79
+
80
+ yt = ytComments.yt_manager(channel_url, old_save=path_save)
81
+ yt.import_excel() # Import the old save data
82
+ yt.export_excel() # Export the data in Excel files
83
+
84
+ ```
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: Youtube-Comment-Export
3
+ Version: 0.1.0
4
+ Summary: Export a YouTube channel Comments in a nice Excel format.
5
+ Home-page: https://github.com/Atem83/Youtube-Comment-Export
6
+ Author: Michaël AUGUSTE
7
+ License: MIT
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Description-Content-Type: text/markdown
12
+ License-File: License
13
+ Requires-Dist: yt_dlp
14
+ Requires-Dist: polars
15
+ Requires-Dist: xlsxwriter
16
+ Requires-Dist: colorama
17
+ Requires-Dist: PySide6
18
+ Dynamic: license-file
19
+
20
+ <h1 align="center">Youtube Comment Export</h1>
21
+
22
+ <h3 align="center">Export the comments of a YouTube channel in Excel files.</h3>
23
+
24
+ <div align="center">
25
+
26
+ [![PyPI](https://img.shields.io/pypi/v/Youtube-Comment-Export?style=flat)](https://pypi.org/project/Youtube-Comment-Export)
27
+ <a href="https://opensource.org/license/mit">![License](https://img.shields.io/badge/License-MIT-blue)</a>
28
+ <a href="https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip">![Download](https://img.shields.io/badge/Source_Code-Download-blue)</a>
29
+ ![LOC](https://tokei.rs/b1/github/Atem83/Youtube-Comment-Export?category=lines)
30
+
31
+ </div>
32
+
33
+ <div align="center">
34
+ <div style="display: flex; justify-content: space-around;">
35
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI light theme.png" alt="GUI Light Theme" style="width: 35%;">
36
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI dark theme.png" alt="GUI Dark Theme" style="width: 35%;">
37
+ </div>
38
+ </div>
39
+
40
+ <br>
41
+
42
+ <div align="center">
43
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/GUI Settings.png" alt="GUI Settings" style="width: 35%;">
44
+ </div>
45
+
46
+ <h2 align="center"> Excel Main Sheet </h2>
47
+
48
+ <div align="center">
49
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel videos sheet.png" alt="Excel videos sheet" style="width: 100%;">
50
+ </div>
51
+
52
+ <h2 align="center"> Excel Comments Sheet </h2>
53
+
54
+ <div align="center">
55
+ <img src="https://raw.githubusercontent.com/Atem83/Youtube-Comment-Export/main/images/Excel comments sheet.png" alt="Excel comments sheet" style="width: 100%;">
56
+ </div>
57
+
58
+ <h2 align="center"> Features </h2>
59
+
60
+ - Download data from a YouTube channel
61
+ - Download comments from a YouTube channel
62
+ - Export the data and comments in Excel files in a nice format
63
+ - Light ou Dark theme according to your OS theme
64
+ - Import old saves, this way :
65
+ - you can keep a more precise date of the comments
66
+ - you can keep comments even if they have been deleted
67
+ - sadly, it will not be possible to save downloading time because all the comments needs to be downloaded again
68
+
69
+ <h2 align="center"> Installation </h2>
70
+
71
+ <div align="center">
72
+
73
+ ```
74
+ pip install Youtube-Comment-Export
75
+ ```
76
+
77
+ [<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/Atem83/Youtube-Comment-Export?&color=green&label=Source%20Code&logo=Python&logoColor=yellow&style=for-the-badge" width="300">](https://github.com/Atem83/Youtube-Comment-Export/archive/refs/heads/main.zip)
78
+
79
+ </div>
80
+
81
+ <h2 align="center"> GUI Usage </h2>
82
+
83
+ ```python
84
+ import ytComments
85
+
86
+ app = ytComments.App()
87
+ app.run()
88
+ ```
89
+ <h2 align="center"> Python Usage </h2>
90
+
91
+ ```python
92
+ import ytComments
93
+
94
+ channel_url = 'https://www.youtube.com/@GabbPiano'
95
+ path_save1 = r'C:\Users\User\Desktop\Save File 1.xlsx'
96
+ path_save2 = r'C:\Users\User\Desktop\Save File 2.xlsx'
97
+ path_save = [path_save1, path_save2]
98
+
99
+ yt = ytComments.yt_manager(channel_url, old_save=path_save)
100
+ yt.import_excel() # Import the old save data
101
+ yt.export_excel() # Export the data in Excel files
102
+
103
+ ```
@@ -0,0 +1,23 @@
1
+ License
2
+ README.md
3
+ pyproject.toml
4
+ setup.cfg
5
+ Youtube_Comment_Export.egg-info/PKG-INFO
6
+ Youtube_Comment_Export.egg-info/SOURCES.txt
7
+ Youtube_Comment_Export.egg-info/dependency_links.txt
8
+ Youtube_Comment_Export.egg-info/entry_points.txt
9
+ Youtube_Comment_Export.egg-info/requires.txt
10
+ Youtube_Comment_Export.egg-info/top_level.txt
11
+ ytComments/__init__.py
12
+ ytComments/metadata.py
13
+ ytComments/settingsManager.py
14
+ ytComments/youtube.py
15
+ ytComments/gui/__init__.py
16
+ ytComments/gui/about.py
17
+ ytComments/gui/app.py
18
+ ytComments/gui/error.py
19
+ ytComments/gui/main.py
20
+ ytComments/gui/menu.py
21
+ ytComments/gui/progressbar.py
22
+ ytComments/gui/settings.py
23
+ ytComments/gui/update.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ytComments-gui = ytComments.gui.App:run
@@ -0,0 +1,5 @@
1
+ yt_dlp
2
+ polars
3
+ xlsxwriter
4
+ colorama
5
+ PySide6
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.tbump]
6
+ github_url = "https://github.com/Atem83/Youtube-Comment-Export"
7
+
8
+ [tool.tbump.version]
9
+ current = "0.1.0"
10
+
11
+ # Example of a semver regexp.
12
+ # Make sure this matches current_version before
13
+ # using tbump
14
+ regex = '''
15
+ (?P<major>\d+)
16
+ \.
17
+ (?P<minor>\d+)
18
+ \.
19
+ (?P<patch>\d+)
20
+ '''
21
+
22
+ [tool.tbump.git]
23
+ message_template = "Bump to {new_version}"
24
+ tag_template = "v{new_version}"
25
+
26
+ # For each file to patch, add a [[tool.tbump.file]] config
27
+ # section containing the path of the file, relative to the
28
+ # tbump.toml location.
29
+ [[tool.tbump.file]]
30
+ src = "setup.cfg"
@@ -0,0 +1,32 @@
1
+ [metadata]
2
+ name = Youtube-Comment-Export
3
+ version = 0.1.0
4
+ author = Michaël AUGUSTE
5
+ description = Export a YouTube channel Comments in a nice Excel format.
6
+ long_description = file: README.md
7
+ long_description_content_type = text/markdown
8
+ url = https://github.com/Atem83/Youtube-Comment-Export
9
+ license = MIT
10
+ license_file = License
11
+ classifiers =
12
+ Operating System :: OS Independent
13
+ Programming Language :: Python
14
+ License :: OSI Approved :: MIT License
15
+
16
+ [options]
17
+ packages = find:
18
+ install_requires =
19
+ yt_dlp
20
+ polars
21
+ xlsxwriter
22
+ colorama
23
+ PySide6
24
+
25
+ [options.entry_points]
26
+ console_scripts =
27
+ ytComments-gui = ytComments.gui.App:run
28
+
29
+ [egg_info]
30
+ tag_build =
31
+ tag_date = 0
32
+
@@ -0,0 +1,5 @@
1
+ from .youtube import yt_manager
2
+ from .gui.app import App
3
+ from .settingsManager import Settings
4
+
5
+ __all__ = ["yt_manager", "App", "Settings"]
@@ -0,0 +1,19 @@
1
+ from .app import App
2
+ from .main import MainWindow
3
+ from .menu import MenuBar
4
+ from .progressbar import LoadingWindow
5
+ from .settings import SettingsWindow
6
+ from .about import AboutWindow
7
+ from .update import UpdateManager
8
+ from .error import run_error
9
+
10
+ __all__ = [
11
+ "App",
12
+ "MainWindow",
13
+ "MenuBar",
14
+ "LoadingWindow",
15
+ "SettingsWindow",
16
+ "AboutWindow",
17
+ "UpdateManager",
18
+ "run_error",
19
+ ]
@@ -0,0 +1,131 @@
1
+ import re
2
+ import ytComments.metadata as metadata
3
+ from PySide6 import QtWidgets, QtCore, QtGui
4
+ from .update import UpdateManager
5
+ from .error import run_error
6
+
7
+ class AboutWindow(QtWidgets.QDialog):
8
+ """About menu of the application"""
9
+ def __init__(self, parent):
10
+ super().__init__(parent)
11
+ self.menu = parent
12
+ self.setWindowTitle("About")
13
+ layout = QtWidgets.QVBoxLayout()
14
+
15
+ self.init_version()
16
+ layout.addLayout(self.layout_version)
17
+
18
+ self.init_author()
19
+ layout.addLayout(self.layout_author)
20
+
21
+ self.init_license()
22
+ layout.addLayout(self.layout_license)
23
+
24
+ self.init_description()
25
+ layout.addSpacing(10)
26
+ layout.addLayout(self.layout_description)
27
+
28
+ self.setLayout(layout)
29
+
30
+ def init_version(self):
31
+ """Version number and search update button."""
32
+ self.layout_version = QtWidgets.QHBoxLayout()
33
+ version_label = QtWidgets.QLabel("Version : ")
34
+ version_text = QtWidgets.QLabel(metadata.version)
35
+
36
+ # Add the button to check for updates
37
+ self.check_update_button = QtWidgets.QPushButton("Check updates")
38
+ self.check_update_button.setStyleSheet(self.style_link())
39
+ self.check_update_button.clicked.connect(self.check_for_updates)
40
+
41
+ self.layout_version.addWidget(version_label)
42
+ self.layout_version.addWidget(version_text)
43
+ self.layout_version.addWidget(self.check_update_button)
44
+ self.layout_version.setAlignment(QtCore.Qt.AlignLeft)
45
+
46
+ def init_author(self):
47
+ """Program Author."""
48
+ self.layout_author = QtWidgets.QHBoxLayout()
49
+ author_label = QtWidgets.QLabel("Author : ")
50
+ author_text = QtWidgets.QLabel(metadata.author)
51
+
52
+ self.layout_author.addWidget(author_label)
53
+ self.layout_author.addWidget(author_text)
54
+ self.layout_author.setAlignment(QtCore.Qt.AlignLeft)
55
+
56
+ def init_license(self):
57
+ """License and code source url."""
58
+ self.layout_license = QtWidgets.QHBoxLayout()
59
+ license_label = QtWidgets.QLabel("License : ")
60
+ license_text = QtWidgets.QLabel(metadata.license)
61
+
62
+ url_button = QtWidgets.QPushButton("code source")
63
+ url_button.setStyleSheet(self.style_link())
64
+ url_button.clicked.connect(
65
+ lambda: QtGui.QDesktopServices.openUrl(QtCore.QUrl(metadata.url))
66
+ )
67
+
68
+ self.layout_license.addWidget(license_label)
69
+ self.layout_license.addWidget(license_text)
70
+ self.layout_license.addWidget(url_button)
71
+ self.layout_license.setAlignment(QtCore.Qt.AlignLeft)
72
+
73
+ def init_description(self):
74
+ """Software description."""
75
+ self.layout_description = QtWidgets.QHBoxLayout()
76
+ description_text = QtWidgets.QLabel(metadata.description)
77
+ self.layout_description.addWidget(description_text)
78
+
79
+ def style_link(self):
80
+ """Style for links."""
81
+ css = """
82
+ QPushButton {
83
+ border: none; /* No border */
84
+ background: none; /* No background */
85
+ color: DodgerBlue; /* Text color */
86
+ text-decoration: underline; /* Underlined text to look like a link */
87
+ }
88
+ QPushButton:hover {
89
+ color: RoyalBlue; /* Text color on hover */
90
+ }
91
+ """
92
+ return css
93
+
94
+ def extract_repo_info(self, url: str):
95
+ """Extracts the username and repository name from a GitHub URL."""
96
+ pattern = r'https?://(?:www\.)?github\.com/([^/]+)/([^/]+)'
97
+ match = re.match(pattern, url)
98
+
99
+ if match:
100
+ repo_owner = match.group(1)
101
+ repo_name = match.group(2)
102
+ return repo_owner, repo_name
103
+ else:
104
+ raise ValueError(
105
+ "invalid URL"
106
+ )
107
+
108
+ def check_for_updates(self):
109
+ """Check for update availability."""
110
+ self.check_update_button.setEnabled(False)
111
+ self.check_update_button.setText("Checking for updates...")
112
+ QtWidgets.QApplication.processEvents()
113
+
114
+ repo_owner, repo_name = self.extract_repo_info(metadata.url)
115
+ updater = UpdateManager(repo_owner, repo_name, self)
116
+ if updater.check_updates():
117
+ self.check_update_button.setText("Downloading update...")
118
+ QtWidgets.QApplication.processEvents()
119
+ try:
120
+ updater.update_software()
121
+ self.check_update_button.setText("Update completed")
122
+ updater.show_file_location_message(updater.new_filedir)
123
+ self.menu.app.close()
124
+ except Exception as e:
125
+ msg = "An error occurred during the update"
126
+ self.check_update_button.setText(msg)
127
+ run_error(msg, details = e)
128
+ else:
129
+ self.check_update_button.setText("Software up to date")
130
+
131
+ self.check_update_button.setEnabled(True)
@@ -0,0 +1,97 @@
1
+ import sys
2
+ import ytComments.metadata as metadata
3
+ from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox
4
+ from ytComments import yt_manager
5
+ from .menu import MenuBar
6
+ from .main import MainWindow
7
+ from .update import UpdateManager
8
+ from .error import run_error
9
+
10
+ class App(QMainWindow):
11
+ """Main application class."""
12
+ def __init__(self):
13
+ # Initialize QApplication
14
+ self.qapp = QApplication(sys.argv)
15
+
16
+ # Initialize QMainWindow
17
+ super().__init__()
18
+ self.setWindowTitle(metadata.name)
19
+ #self.setGeometry(200, 200, 360, 400)
20
+ self.yt = yt_manager()
21
+
22
+ # Create the main window
23
+ self.main_frame = MainWindow(self)
24
+ self.setCentralWidget(self.main_frame)
25
+
26
+ # Create the menu bar
27
+ self.menu_bar = MenuBar(self)
28
+ self.setMenuBar(self.menu_bar)
29
+
30
+ # Connect the window resize event
31
+ self.resizeEvent = self.on_resize
32
+
33
+ # Allow the window to accept drag-and-drop events for files
34
+ self.setAcceptDrops(True)
35
+
36
+ def run(self):
37
+ """Execution of the application."""
38
+ self.show()
39
+ self.check_for_updates()
40
+ sys.exit(self.qapp.exec())
41
+
42
+ def on_resize(self, event):
43
+ """Execute actions when the main window is resized."""
44
+ #print(f"Dimensions of the window : {self.width()}x{self.height()}")
45
+ super().resizeEvent(event)
46
+
47
+ def dragEnterEvent(self, event):
48
+ """Manage the drag-and-drop event.
49
+ Only accept files."""
50
+ if event.mimeData().hasUrls():
51
+ event.accept() # Accept the event
52
+ else:
53
+ event.ignore() # Ignore if it's not a file
54
+
55
+ def dropEvent(self, event):
56
+ """Manage the drop event and retrieve the dropped file."""
57
+ if event.mimeData().hasUrls():
58
+ # Retrieve the URLs from the mimeData
59
+ urls = event.mimeData().urls()
60
+ # Convert the URLs to a local path
61
+ list_urls = []
62
+ for url in urls:
63
+ file_path = url.toLocalFile()
64
+ list_urls.append(file_path)
65
+ # Set the path in the QLineEdit
66
+ self.main_frame.old_save_input.setText(";".join(list_urls))
67
+
68
+ def check_for_updates(self):
69
+ """Check for updates."""
70
+ repo_owner, repo_name = self.menu_bar.about_dialog.extract_repo_info(
71
+ metadata.url
72
+ )
73
+ updater = UpdateManager(repo_owner, repo_name, self)
74
+ reply = None
75
+
76
+ # Check for updates
77
+ if updater.check_updates() and self.yt.settings.auto_update:
78
+ msg = "An update is available,"
79
+ msg += "\nwould you like to update the software ?"
80
+ reply = QMessageBox.question(
81
+ None,
82
+ "Information",
83
+ msg,
84
+ QMessageBox.Yes | QMessageBox.No
85
+ )
86
+
87
+ # Download the update
88
+ if updater.check_updates() and reply == QMessageBox.Yes:
89
+ try:
90
+ updater.update_software()
91
+ updater.show_file_location_message(updater.new_filedir)
92
+ self.close()
93
+ sys.exit(self.qapp.exec())
94
+ except Exception as e:
95
+ msg = "An error occurred during the update"
96
+ run_error(msg, details = e)
97
+