#!/usr/bin/perl # /media/fritz/175F-DC61/2022.bak/2.22.bak use v5.030; use Time::Piece; use Log::Log4perl; use IPC::System::Simple qw/systemx capturex/; use utf8; my ($argv1) = @ARGV; if (not defined $argv1) { die "Need argv1\n"; } my $t = localtime; my $jd = $t->julian_day; my $log_conf4 = '/home/fritz/Documents/perlmonks/conf_files/4.conf'; Log::Log4perl::init($log_conf4); #info my $logger = Log::Log4perl->get_logger(); $logger->info("Time is $t"); $logger->info("Julian day is $jd"); $logger->info("$0"); my $ini_path = qw( /home/fritz/Documents/perlmonks/conf_files/1.тайный.txt ); my $ref_config = get_тайный($ini_path); #$DB::single = 1; my %h = %$ref_config; my $capture = capturex "bash","6.git.sh", "@ARGV"; $logger->info("capx: $capture"); sub get_тайный { use Config::Tiny; use Data::Dump; my %h; #creating here and exporting reference to caller my $ini_path = shift; #caller provides inipath my $sub_hash1 = "gitlab"; my $Config = Config::Tiny->new; $Config = Config::Tiny->read( $ini_path, 'utf8' ); # -> is optional between brackets $h{email} = $Config->{$sub_hash1}{'email'}; $h{name} = $Config->{$sub_hash1}{'name'}; $h{pass} = $Config->{$sub_hash1}{'pass'}; my $sub_hash2 = "bash"; $h{bash_root} = $Config->{$sub_hash2}{'bash_root'}; my $ref_config = \%h; #dd $ref_config; $DB::single = 1; return ($ref_config); } __END__ #### #!/bin/bash # Create README.md with the current directory information pwd > README.md # Initialize a new Git repository (or reinitialize if it already exists) git init # Hardcode Git user information git config --global user.email "redacted@redacted" git config --global user.name "@redacted" # Add a list of files to README.md ls >> README.md # Add files to the staging area git add README.md git add *.pl *.sh *.txt *.py # Set up the remote repository URL (using SSH) if ! git remote | grep -q origin; then git remote add origin git@gitlab.com:aardvark/hja.git else echo "Remote 'origin' already exists." fi # Create a verbose, descriptive commit message based on staged changes who=$(printenv USER) now=$(date) file_list=$(git diff --cached --name-only | tr '\n' ', ' | sed 's/, $//') # Commit all staged changes git commit -m "On $now, $who added changes in files: $file_list" || { echo "Failed to commit changes"; exit 1; } # Push changes to the main branch git branch -M main git push -u origin main echo "Script completed successfully." #### 2024/11/05 19:36:08 INFO Time is Tue Nov 5 19:36:07 2024 2024/11/05 19:36:08 INFO Julian day is 2460620.60841435 2024/11/05 19:36:08 INFO 4.wrap.pl 2024/11/05 19:36:13 INFO capx: Reinitialized existing Git repository in /home/fritz/Desktop/dl2/repack/.git/ Remote 'origin' already exists. [main 8f1999b] On Tue 05 Nov 2024 07:36:08 PM MST, fritz added changes in files: 4.wrap.pl, 1 file changed, 1 insertion(+), 1 deletion(-) Script completed successfully. #### { "download_path": "/media/fritz/9766-DD0B/2024-11-03/", "cookie_path": null, "url": "https://www.youtube.com/watch?v=YDP2tR6MXNA", "font": "Arial Bold", "font_size": 64, "username_color": "yellow", "date_color": "cyan", "timestamp_color": "red", "username_position": [ "left", "top" ], "date_position": [ "left", "bottom" ], "timestamp_position": [ "right", "bottom" ], "overall_start": 2, "caption_top": "15%", "caption_bottom": "75%", "line_width": "8%", "hor_offset": "4%", "cap_length": 5, "max_number": 60, "max_char_width": 65, "next_line": 1.7, "pause_between_para": 2, "source_path": "/app/data/4.source.txt", "shadow": { "color": "black", "offset": 5, "opacity": 0.6 }, "video_title": "Tim_Ballard_20241028_4_watermarked_captioned", "video_date": "20241029", "uploader": "Perl Gonzalez", "duration": 151, "width": 1920, "height": 1080, "id": "YDP2tR6MXNA", "ext": "mkv", "resolution": "1920x1080", "fps": 24, "tbr": 2183.114, "protocol": "https+https", "vcodec": "avc1.640028", "vbr": 2065.741, "acodec": "opus", "abr": 117.373, "asr": 48000, "original_filename": "/media/fritz/9766-DD0B/2024-11-03/Perl_Gonzalez_20241029.mkv", "to_process": "/media/fritz/9766-DD0B/2024-11-03/Perl_Gonzalez_20241029.mkv" } #### # Start with the base image (Ubuntu in this case) FROM ubuntu:22.04 # Update apt repository and install necessary dependencies including ffmpeg RUN apt-get update && \ apt-get install -y --no-install-recommends \ ffmpeg \ python3 \ python3-pip && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /app # Copy all files into the Docker image COPY . /app # Install Python dependencies RUN pip3 install --upgrade pip && pip3 install -r requirements.txt --root-user-action=ignore RUN ls -la * /app #### # Check if the Docker image exists if [[ "$(docker images -q my_dl:latest 2> /dev/null)" == "" ]]; then echo "Docker image 'my_dl:latest' does not exist. Building the image..." docker build -t my_dl . else echo "Docker image 'my_dl:latest' found." fi # Proceed with Docker run command using the validated paths echo "Running Docker with the specified volume and config path..." docker run --rm \ -v "$(pwd)":/app \ -v "$Config_Path":/app/data/8.config.json \ -v "$usb_mount_point":"$usb_mount_point" \ my_dl python3 4.caller.py "$1" | tee -a "$LOGFILE"