Skip to content

Commit

Permalink
Merge pull request #9 from mgregory1994/v0.2.0
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
mgregory1994 committed Feb 7, 2022
2 parents a8a0a20 + 63a2075 commit 3924e84
Show file tree
Hide file tree
Showing 251 changed files with 22,953 additions and 17,094 deletions.
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,48 @@
Render Watch is an open source video transcoder for Linux.

## Compatibility
Render Watch is available as a flatpak(version 0.2.0) and can also be installed from source.
Render Watch is available as a flatpak(version 1.0.0) and can also be installed from source.
Render Watch should theoretically work on any Linux distribution that has the ability to run Python, Gtk, PyGObject, and
ffmpeg/ffinfo/ffplay.

## Installation
#### Flatpak:
###### Available starting version 0.2.0
###### Available starting version 1.0.0

#### From source:
1. Install dependencies
* ffmpeg
* [PyGObject](https://pygobject.readthedocs.io/en/latest/getting_started.html)
* pip
* ffmpeg
* [PyGObject](https://pygobject.readthedocs.io/en/latest/getting_started.html)
* python-pip
2. Clone repository
```bash
git clone https://github.com/mgregory1994/RenderWatch.git
```
```bash
git clone https://github.com/mgregory1994/RenderWatch.git
```
3. Manually install Render Watch
```bash
cd RenderWatch
sudo python setup.py install
```
```bash
cd RenderWatch
git checkout v0.2.0-beta
sudo python setup.py install
```
4. Copy .desktop file and program icons
```bash
cp data/render-watch.desktop ~/.local/share/applications
cp -r data/icons/. ~/.icons
```
```bash
cp data/render-watch.desktop ~/.local/share/applications
cp -r data/icons/. ~/.icons
```

## Uninstall
#### Flatpak:
###### Available starting version 0.2.0
###### Available starting version 1.0.0

#### From source:
1. Remove .desktop file
```bash
rm ~/.local/share/applications/render-watch.desktop
```
```bash
rm ~/.local/share/applications/render-watch.desktop
```
2. Remove Render Watch using pip
```bash
sudo pip uninstall render-watch
```
```bash
sudo pip uninstall render-watch
```

## Usage
Once you have installed Render Watch, you can find it among your installed
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='Render Watch',
version='0.1.1',
version='0.2.0',
url='https://github.com/mgregory1994/RenderWatch',
license='GPLV3',
author='Michael Gregory',
Expand All @@ -19,9 +19,10 @@
'render_watch/signals/aac', 'render_watch/signals/active_page', 'render_watch/signals/active_row',
'render_watch/signals/completed_page', 'render_watch/signals/completed_row', 'render_watch/signals/crop',
'render_watch/signals/inputs_page', 'render_watch/signals/inputs_row', 'render_watch/signals/main_window',
'render_watch/signals/nvenc', 'render_watch/signals/opus', 'render_watch/signals/prefs',
'render_watch/signals/preview', 'render_watch/signals/settings_sidebar', 'render_watch/signals/trim',
'render_watch/signals/vp9', 'render_watch/signals/x264', 'render_watch/signals/x265', 'render_watch/startup'
'render_watch/signals/nvenc', 'render_watch/signals/opus', 'render_watch/signals/application_preferences',
'render_watch/signals/preview', 'render_watch/signals/settings_sidebar', 'render_watch/signals/subtitles',
'render_watch/signals/trim', 'render_watch/signals/vp9', 'render_watch/signals/x264',
'render_watch/signals/x265', 'render_watch/startup'
],
install_requires=[
'PyGObject',
Expand Down
17 changes: 9 additions & 8 deletions src/render_watch/app_formatting/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
# along with Render Watch. If not, see <https://www.gnu.org/licenses/>.


from datetime import datetime


counter = -1


Expand All @@ -25,16 +28,14 @@ class AliasGenerator:

@staticmethod
def generate_alias_from_name(name):
"""Use the first character of the name and concatenate the global counter to make an alias name.
The global counter is incremented each time this function is called in order to keep all generated
aliases unique.
"""
Creates a unique alias based off of the first character of the name.
:param name:
Name string to generate an alias from.
:param name: Name to generate an alias from.
"""
global counter
counter += 1

alias = name[0] + '_' + str(counter)
return alias
current_date_time = datetime.now().strftime('_%m-%d-%Y_%H%M%S')

return name[0] + str(counter) + current_date_time
44 changes: 26 additions & 18 deletions src/render_watch/app_formatting/format_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,25 @@


def get_timecode_from_seconds(seconds):
"""Creates and returns a time code string using the number of seconds provided.
"""
Creates and returns a time code string using the number of seconds.
The time code format is HH:MM:SS.
Time code format: HH:MM:SS.
:param seconds:
Number of seconds.
:param seconds: Number of seconds.
"""
hours = int(seconds / 3600)
seconds_left = seconds % 3600
minutes = int(seconds_left / 60)
seconds_left = round(seconds_left % 60, 1)
return _generate_timecode(hours, minutes, seconds_left)


def _generate_timecode(hours, minutes, seconds):
timecode = ''
timecode += _generate_hours_timecode_portion(hours)
timecode += _generate_minutes_timecode_portion(minutes)
timecode += _generate_seconds_timecode_portion(seconds_left)
timecode += _generate_seconds_timecode_portion(seconds)
return timecode


Expand Down Expand Up @@ -71,12 +75,10 @@ def _generate_seconds_timecode_portion(seconds):


def get_seconds_from_timecode(timecode):
"""Returns the total seconds that makes up the given time code.
The hours and minutes are converted into seconds and added to the remaining seconds.
"""
Returns the total seconds that makes up the given timecode.
:param timecode:
Time code string HH:MM:SS.
:param timecode: Timecode string formatted as: HH:MM:SS.
"""
timecode_values = timecode.split(':')
hours = int(timecode_values[0]) * 3600
Expand All @@ -86,25 +88,24 @@ def get_seconds_from_timecode(timecode):


def get_file_size_from_bytes(bytes_value):
"""Converts the given bytes into a more sensible file size string.
"""
Converts the given bytes value into a file size string.
Depending on the bytes value, this will return a string with file sizes as large as GBs and as low as KBs.
:param bytes_value:
Amount of bytes.
:param bytes_value: Amount of bytes.
"""
if _has_gigabytes(bytes_value):
if _is_gigabytes(bytes_value):
return _get_gigabytes_from_bytes(bytes_value)
if _has_megabytes(bytes_value):
if _is_megabytes(bytes_value):
return _get_megabytes_from_bytes(bytes_value)
return _get_kilobytes_from_bytes(bytes_value)


def _has_gigabytes(bytes_value):
def _is_gigabytes(bytes_value):
return int(bytes_value / GIGABYTE_IN_BYTES) != 0


def _has_megabytes(bytes_value):
def _is_megabytes(bytes_value):
return int(bytes_value / MEGABYTE_IN_BYTES) != 0


Expand All @@ -121,3 +122,10 @@ def _get_megabytes_from_bytes(bytes_value):
def _get_kilobytes_from_bytes(bytes_value):
kilobytes = round(bytes_value / KILOBYTE_IN_BYTES, 1)
return str(kilobytes) + 'KB'


def convert_kilobytes_to_bytes(kilobytes):
"""
Converts kilobytes to bytes.
"""
return kilobytes * KILOBYTE_IN_BYTES
37 changes: 21 additions & 16 deletions src/render_watch/app_handlers/aac_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,49 @@


class AacHandlers:
"""Handles all widget changes for the AAC codec."""
"""
Handles all widget changes for the AAC codec.
"""

def __init__(self, gtk_builder, inputs_page_handlers):
self.inputs_page_handlers = inputs_page_handlers
self.is_widgets_setting_up = False

self.aac_bitrate_signal = AacBitrateSignal(self, inputs_page_handlers)
self.aac_channels_signal = AacChannelsSignal(self, inputs_page_handlers)
self.signals_list = (self.aac_bitrate_signal, self.aac_channels_signal)

self.aac_channels_combobox = gtk_builder.get_object('aac_channels_combobox')
self.aac_bitrate_spinbutton = gtk_builder.get_object('aac_bitrate_spinbutton')

def __getattr__(self, signal_name): # Needed for builder.connect_signals() in handlers_manager.py
"""Returns the list of signals this class uses.
Used for Gtk.Builder.get_signals().
def __getattr__(self, signal_name):
"""
If found, return the signal name's function from the list of signals.
:param signal_name:
The signal function name being looked for.
:param signal_name: The signal function name being looked for.
"""
for signal in self.signals_list:
if hasattr(signal, signal_name):
return getattr(signal, signal_name)
raise AttributeError

def get_settings(self, ffmpeg):
"""Applies settings from the widgets to the ffmpeg settings object.
"""
Applies settings from the aac widgets to ffmpeg settings.
:param ffmpeg:
The ffmpeg settings object.
:param ffmpeg: ffmpeg settings.
"""
audio_settings = Aac()
audio_settings.bitrate = self.aac_bitrate_spinbutton.get_value_as_int()
audio_settings.channels = self.aac_channels_combobox.get_active()

ffmpeg.audio_settings = audio_settings

def set_settings(self, custom_ffmpeg=None):
"""Applies settings from the ffmpeg settings object to the widgets.
"""
Configures the aac widgets to match the selected task's ffmpeg settings.
:param custom_ffmpeg:
(Default None) Use a custom ffmpeg settings object.
:param custom_ffmpeg: (Default None) Use custom ffmpeg settings.
"""
if custom_ffmpeg:
ffmpeg = custom_ffmpeg
Expand All @@ -71,9 +74,9 @@ def set_settings(self, custom_ffmpeg=None):
self._setup_aac_settings_widgets(ffmpeg)

def _setup_aac_settings_widgets(self, ffmpeg):
# Uses the ffmpeg settings object to set up the widgets.
audio_settings = ffmpeg.audio_settings
if audio_settings is not None and audio_settings.codec_name == 'aac':

if ffmpeg.is_audio_settings_aac():
self.is_widgets_setting_up = True
self.aac_bitrate_spinbutton.set_value(audio_settings.bitrate)
self.aac_channels_combobox.set_active(audio_settings.channels)
Expand All @@ -82,7 +85,9 @@ def _setup_aac_settings_widgets(self, ffmpeg):
self.reset_settings()

def reset_settings(self):
"""Resets the widgets to their default values."""
"""
Resets the aac widgets to their default values.
"""
self.is_widgets_setting_up = True
self.aac_channels_combobox.set_active(0)
self.aac_bitrate_spinbutton.set_value(128)
Expand Down
Loading

0 comments on commit 3924e84

Please sign in to comment.