Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update: cleanup filenames to match Pu-239 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
darkalchemy committed Feb 3, 2019
1 parent 285bcef commit e1e2519
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@ cd Pu-239-Uploader
composer install
```

### Edit config file
### Edit config.php
```
nano config.php
```

### Running on a single folder
```
php upload.php
```
### Running on a single folder ```php upload.php``` and follow the prompts

### Running on multiple folders
### Running on multiple folders, point ```upload_loop.php``` to the parent folder
```
php upload_loop.php /path/to/parent/folder/
```
Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
"": "src"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"post-install-cmd": [
"composer dump-autoload -o",
"cp -n config.php.example config.php"
],
"post-update-cmd": [
"cp -n config.php.example config.php"
"composer dump-autoload -o"
]
}
}
16 changes: 16 additions & 0 deletions upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function download_torrent($torrent, $config, $tid)

function curl_search($name, $config)
{
$name = getname();
$curl = new Curl();
$curl->post($config['url'] . '/search.php', [
'bot' => $config['username'],
Expand Down Expand Up @@ -176,3 +177,18 @@ function GetDirectorySize($path)
return $bytestotal;
}

function getname($name)
{
$name = str_replace('.torrent', '', $name);
$name = str_ireplace('H.264', 'H_264', $name);
$name = str_replace('7.1', '7_1', $name);
$name = str_replace('5.1', '5_1', $name);
$name = str_replace('2.1', '2_1', $name);
$name = str_ireplace('.', ' ', $name);
$name = str_ireplace('H_264', 'H.264', $name);
$name = str_replace('7_1', '7.1', $name);
$name = str_replace('5_1', '5.1', $name);
$name = str_replace('2_1', '2.1', $name);

return $name;
}

0 comments on commit e1e2519

Please sign in to comment.