Compare commits

..

No commits in common. "main" and "mediaInfoSama" have entirely different histories.

6 changed files with 13 additions and 23 deletions

4
.gitignore vendored
View File

@ -124,7 +124,3 @@ dmypy.json
.pyre/ .pyre/
TODO TODO
toBinary
binary/

View File

@ -91,6 +91,9 @@ font: 11pt &quot;UbuntuMono NF&quot;;</string>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

@ -1,2 +0,0 @@
if __name__ == "__main__":
import main

View File

@ -1,4 +1,5 @@
import os, subprocess import os, subprocess, json
from shlex import quote
class FileCmds: class FileCmds:
def __init__(self, file_path): def __init__(self, file_path):
@ -18,7 +19,7 @@ class FileCmds:
:type cmd: str :type cmd: str
:return: str :return: str
''' '''
process = subprocess.Popen(cmd, stdout=subprocess.PIPE) process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
output, error = process.communicate() output, error = process.communicate()
return output return output
@ -43,7 +44,7 @@ class FileCmds:
:type inform: str :type inform: str
:rtype: str :rtype: str
''' '''
bash_command = ["mediainfo", f"--Inform={inform}", self.file_path] bash_command = f"mediainfo --Inform={quote(inform)} {quote(self.file_path)}"
output = self.execute_bash(bash_command).decode('utf-8') output = self.execute_bash(bash_command).decode('utf-8')
return output return output
@ -81,8 +82,8 @@ class FileCmds:
''' '''
inform_general = r"General;G: %Format%, %FileSize_String%, %Duration_String%, %BitRate_String%\n" inform_general = r"General;G: %Format%, %FileSize_String%, %Duration_String%, %BitRate_String%\n"
inform_video = r"Video;V: %Format%, %Format_Profile%, %StreamSize_String%, %Width%x%Height%, %FrameRate% FPS, %BitRate_String%\n" inform_video = r"Video;V: %Format%, %Format_Profile%, %StreamSize_String%, %Width%x%Height%, %FrameRate% FPS, %BitRate_String%\n"
inform_audio = r"Audio;A: %Language_String%, %Title%, %Format%, %StreamSize_String%, %BitRate_String%, %Channel(s)_String%, %SamplingRate_String%\n" inform_audio = r"Audio;A: %Language_String%, %Format%, %StreamSize_String%, %BitRate_String%, %Channel(s)_String%, %SamplingRate_String%\n"
inform_text = r"Text;T: %Language_String%, %Title%, %Format%\n" inform_text = r"Text;T: %Language_String%, %Format%\n"
informs = [inform_general] informs = [inform_general]
@ -104,7 +105,7 @@ class FileCmds:
output += "M: Menu\n\n" output += "M: Menu\n\n"
output += "\n" output += "\n"
output += self.execute_bash(["mediainfo", self.file_path]).decode('utf-8') output += self.execute_bash(f"mediainfo {quote(self.file_path)}").decode('utf-8')
return(output) return(output)
@ -114,7 +115,7 @@ class FileCmds:
:rtype: string :rtype: string
''' '''
output = self.execute_bash(["mediainfo", "--Full", self.file_path]).decode('utf-8') output = self.execute_bash(f"mediainfo --Full {quote(self.file_path)}").decode('utf-8')
return output return output

View File

@ -1,6 +1,6 @@
from PySide6.QtWidgets import QWidget from PySide6.QtWidgets import QWidget
from PySide6.QtCore import QSize from PySide6.QtCore import QSize
from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor, QTextBlockFormat from PySide6.QtGui import QTextCharFormat, QTextCursor, QColor
from ui_main_window import Ui_MainWindow from ui_main_window import Ui_MainWindow
from file_cmds import FileCmds from file_cmds import FileCmds
@ -62,17 +62,8 @@ class MainWindow(QWidget, Ui_MainWindow):
self.content = self.file_cmds.tabs_content[item_selected[0].text()] self.content = self.file_cmds.tabs_content[item_selected[0].text()]
self.detail_text_edit.setPlainText(self.content) self.detail_text_edit.setPlainText(self.content)
self.search() self.search()
self.wrap_line_indent()
def wrap_line_indent(self):
cursor = QTextCursor(self.detail_text_edit.document())
cursor.select(QTextCursor.Document)
fmt = QTextBlockFormat()
fmt.setLeftMargin(100)
fmt.setTextIndent(-100)
cursor.mergeBlockFormat(fmt)
def search(self): def search(self):
to_search = self.search_line_edit.text() to_search = self.search_line_edit.text()

View File

@ -65,6 +65,7 @@ class Ui_MainWindow(object):
self.detail_text_edit.setObjectName(u"detail_text_edit") self.detail_text_edit.setObjectName(u"detail_text_edit")
self.detail_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);") self.detail_text_edit.setStyleSheet(u"background-color: rgb(42, 42, 42);")
self.detail_text_edit.setFrameShape(QFrame.NoFrame) self.detail_text_edit.setFrameShape(QFrame.NoFrame)
self.detail_text_edit.setLineWrapMode(QTextEdit.NoWrap)
self.detail_text_edit.setReadOnly(True) self.detail_text_edit.setReadOnly(True)
self.splitter.addWidget(self.detail_text_edit) self.splitter.addWidget(self.detail_text_edit)