Compare commits
6 Commits
Video_clas
...
166712515d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
166712515d | ||
![]() |
bafa23131a | ||
![]() |
782ab1783d | ||
72fd5457e6 | |||
6c6c09a158 | |||
82f8a61d16 |
@@ -1,18 +1,36 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
class History: #Abstract class
|
class History: #Abstract class
|
||||||
def __init__(self, filename):
|
def __init__(self, filename: str):
|
||||||
self.history = list()
|
#self.history = list()
|
||||||
|
pass
|
||||||
|
|
||||||
def __size__(self):
|
def __size__(self):
|
||||||
return len(history)
|
pass
|
||||||
|
|
||||||
def parse_history(self, filename):
|
|
||||||
return history
|
|
||||||
|
|
||||||
def is_this_type(self, filename): # bool function,
|
@staticmethod
|
||||||
return false # returns false if Youtube history
|
def parse_history(self, filename: str):
|
||||||
|
parsed_data = []
|
||||||
|
|
||||||
def get_video(self, index):
|
with open(filename, "r", encoding="utf-8") as file:
|
||||||
return history[index]
|
for line in file:
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
parsed_data.append(json.loads(line))
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
fixed_line = fix_unquoted_values(line)
|
||||||
|
parsed_data.append(json.loads(fixed_line))
|
||||||
|
|
||||||
|
return parsed_data
|
||||||
|
|
||||||
|
def is_this_type(self, filename: str): # bool function,
|
||||||
|
pass # returns false if Youtube history
|
||||||
|
|
||||||
|
def get_video(self, index: int):
|
||||||
|
pass
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(history)
|
pass
|
||||||
|
|
||||||
|
@@ -1,3 +1,20 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2025 Fedir Kovalov.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, version 3.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
class Video:
|
class Video:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
Reference in New Issue
Block a user