Skip to content

Commit

Permalink
added code to handle colons in file names
Browse files Browse the repository at this point in the history
Bumped the version to 2018.10 (the final release for 2018) and added some code to handle colons in file names.
  • Loading branch information
ech0wav3 committed Feb 11, 2019
1 parent 41587b7 commit 7ec8666
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Compile/compile_dvd2mkv.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@echo off
SET installdir=%CD:~0,3%

mkdir %installdir%dvd2mkv-2018.09\
mkdir %installdir%dvd2mkv-2018.10\
echo Compiling dvd2mkv...
bamcompile1.21\bamcompile -c ..\dvd2mkv.php %installdir%dvd2mkv-2018.09\dvd2mkv.exe
bamcompile1.21\bamcompile -c ..\dvd2mkv.php %installdir%dvd2mkv-2018.10\dvd2mkv.exe
echo Copying settings...
copy /y ..\settings.conf %installdir%dvd2mkv-2018.09\settings.conf
copy /y ..\settings.conf %installdir%dvd2mkv-2018.10\settings.conf
echo Copying required files...
robocopy "..\Support Apps " %installdir%dvd2mkv-2018.09\ /s /e
robocopy "..\Support Apps " %installdir%dvd2mkv-2018.10\ /s /e
echo Setup complete!
echo dvd2mkv can be found at: %installdir%dvd2mkv-2018.09\
echo dvd2mkv can be found at: %installdir%dvd2mkv-2018.10\
pause
10 changes: 9 additions & 1 deletion dvd2mkv.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

###### Version #######
$d2m_ver = "2018.09";
$d2m_ver = "2018.10";

## Load program location variables from outside source
if (file_exists("settings.conf")) {
Expand Down Expand Up @@ -67,8 +67,15 @@ function SanitizeName($strToUse) {
// Replace spaces with a '_'
$temp = str_replace(" ", "_", $temp);
$temp = str_replace(".", "_", $temp);
$temp = str_replace(":", "_", $temp);
$result = $temp;

// Replace triple underscores with a single underscore
$result = str_replace("___", "_", $result);

// Replace double underscores with a single underscore
$result = str_replace("__", "_", $result);

// Return filename
return $result;
}
Expand All @@ -83,6 +90,7 @@ function filename($filename) {
// Replace spaces with a '_'
$temp = str_replace(" ", "_", $temp);
$temp = str_replace(".", "_", $temp);
$temp = str_replace(":", "_", $temp);

// Loop through string
$result = '';
Expand Down

0 comments on commit 7ec8666

Please sign in to comment.