-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
87 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# System imports | ||
import os | ||
import logging | ||
|
||
# Custom imports | ||
from nzbToMediaUtil import iterate_media_files | ||
|
||
|
||
Logger = logging.getLogger(__name__) | ||
|
||
|
||
def process_all_exceptions(name, dirname): | ||
for group, exception in __customgroups__.items(): | ||
if not group in name: | ||
continue | ||
process_exception(exception, name, dirname) | ||
|
||
|
||
def process_exception(exception, name, dirname): | ||
for parentDir, filename in iterate_media_files(dirname): | ||
exception(filename, parentDir) | ||
|
||
|
||
def process_qoq(filename, dirname): | ||
Logger.debug("Reversing the file name for a QoQ release %s", filename) | ||
head, fileExtention = os.path.splitext(filename) | ||
newname = head[::-1] | ||
newfile = newname + fileExtention | ||
newfilePath = os.path.join(dirname, newfile) | ||
os.rename(filename, newfilePath) | ||
Logger.debug("New file name is %s", newfile) | ||
|
||
# dict for custom groups | ||
# we can add more to this list | ||
__customgroups__ = {'[=-< Q o Q >-=]': process_qoq} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters