'Post-process a given file
:return: True on success, False on failure'

@property
def process(self):

    self._log(u'Processing    {}'.format(self.file_path))
    if os.path.isdir(self.file_path):
        self._log((u'File    %s    seems    to    be    a    directory' % self.file_path))
        return False
    if (not os.path.exists(self.file_path)):
        self._log((u"File    %s    doesn't    exist,    did    unrar    fail?" % self.file_path))
        return False
    for ignore_file in self.IGNORED_FILESTRINGS:
        if (ignore_file in self.file_path):
            self._log((u'File    %s    is    ignored    type,    skipping' % self.file_path))
            return False
    self.in_history = False
    self.anidbEpisode = None
    (show, season, episodes, quality, version) = self._find_info()
    if (not show):
        self._log(u"This    show    isn't    in    your    list,    you    need    to    add    it    to    SR    before    post-processing    an    episode")
        raise EpisodePostProcessingFailedException()
    elif ((season is None) or (not episodes)):
        self._log(u'Not    enough    information    to    determine    what    episode    this    is.    Quitting    post-processing')
        return False
    ep_obj = self._get_ep_obj(show, season, episodes)
    (_, old_ep_quality) = Quality.splitCompositeStatus(ep_obj.status)
    if (quality and (not (Quality.qualityStrings[quality] == u'Unknown'))):
        self._log((u'Snatch    history    had    a    quality    in    it,    using    that:    ' + Quality.qualityStrings[quality]), sickrage.srCore.srLogger.DEBUG)
        new_ep_quality = quality
    else:
        new_ep_quality = self._get_quality(ep_obj)
    sickrage.srCore.srLogger.debug((u"Quality    of    the    episode    we're    processing:    %s" % new_ep_quality))
    priority_download = self._is_priority(ep_obj, new_ep_quality)
    self._log((u'Is    ep    a    priority    download:    ' + str(priority_download)), sickrage.srCore.srLogger.DEBUG)
    if version:
        self._log((u'Snatch    history    had    a    version    in    it,    using    that:    v' + str(version)), sickrage.srCore.srLogger.DEBUG)
        new_ep_version = version
    else:
        new_ep_version = (-1)
    existing_file_status = self._checkForExistingFile(ep_obj.location)
    if (not priority_download):
        if ((new_ep_quality < old_ep_quality != Quality.UNKNOWN) and (not (existing_file_status == PostProcessor.DOESNT_EXIST))):
            self._log(u'File    exists    and    new    file    quality    is    lower    than    existing,    marking    it    unsafe    to    replace')
            return False
        if (existing_file_status == PostProcessor.EXISTS_LARGER):
            if self.is_proper:
                self._log(u'File    exists    and    new    file    is    smaller,    new    file    is    a    proper/repack,    marking    it    safe    to    replace')
                return True
            else:
                self._log(u'File    exists    and    new    file    is    smaller,    marking    it    unsafe    to    replace')
                return False
        elif (existing_file_status == PostProcessor.EXISTS_SAME):
            self._log(u'File    exists    and    new    file    is    same    size,    marking    it    unsafe    to    replace')
            return False
    else:
        self._log(u"This    download    is    marked    a    priority    download    so    I'm    going    to    replace    an    existing    file    if    I    find    one")
    if (not isFileLocked(self.file_path, False)):
        if (not verify_freespace(self.file_path, ep_obj.show.location, ([ep_obj] + ep_obj.relatedEps))):
            self._log(u'Not    enough    space    to    continue    PP,    exiting', sickrage.srCore.srLogger.WARNING)
            return False
    else:
        self._log(u'Unable    to    determine    needed    filespace    as    the    source    file    is    locked    for    access')
    for cur_ep in ([ep_obj] + ep_obj.relatedEps):
        try:
            self._delete(cur_ep.location, associated_files=True)
            if cur_ep.location:
                delete_empty_folders(os.path.dirname(cur_ep.location), keep_dir=ep_obj.show.location)
        except (OSError, IOError):
            raise EpisodePostProcessingFailedException(u'Unable    to    delete    the    existing    files')
    if ((not os.path.isdir(ep_obj.show.location)) and sickrage.srCore.srConfig.CREATE_MISSING_SHOW_DIRS):
        self._log(u"Show    directory    doesn't    exist,    creating    it", sickrage.srCore.srLogger.DEBUG)
        try:
            os.mkdir(ep_obj.show.location)
            chmodAsParent(ep_obj.show.location)
            sickrage.srCore.notifiersDict[u'synoindex'].addFolder(ep_obj.show.location)
        except (OSError, IOError):
            raise EpisodePostProcessingFailedException((u'Unable    to    create    the    show    directory:    ' + ep_obj.show.location))
        ep_obj.show.writeMetadata(True)
    for cur_ep in ([ep_obj] + ep_obj.relatedEps):
        with cur_ep.lock:
            if self.release_name:
                self._log((u'Found    release    name    ' + self.release_name), sickrage.srCore.srLogger.DEBUG)
                cur_ep.release_name = self.release_name
            else:
                cur_ep.release_name = u''
            if (ep_obj.status in Quality.SNATCHED_BEST):
                cur_ep.status = Quality.compositeStatus(ARCHIVED, new_ep_quality)
            else:
                cur_ep.status = Quality.compositeStatus(DOWNLOADED, new_ep_quality)
            cur_ep.subtitles = u''
            cur_ep.subtitles_searchcount = 0
            cur_ep.subtitles_lastsearch = u'0001-01-01    00:00:00'
            cur_ep.is_proper = self.is_proper
            cur_ep.version = new_ep_version
            if self.release_group:
                cur_ep.release_group = self.release_group
            else:
                cur_ep.release_group = u''
            cur_ep.saveToDB()
    releaseName = show_names.determineReleaseName(self.folder_path, self.nzb_name)
    if (releaseName is not None):
        FailedHistory.logSuccess(releaseName)
    else:
        self._log(u"Couldn't    find    release    in    snatch    history", sickrage.srCore.srLogger.WARNING)
    if (not os.path.isdir(ep_obj.show.location)):
        raise EpisodePostProcessingFailedException(u"Unable    to    post-process    an    episode    if    the    show    dir    doesn't    exist,    quitting")
    proper_path = ep_obj.proper_path()
    proper_absolute_path = os.path.join(ep_obj.show.location, proper_path)
    dest_path = os.path.dirname(proper_absolute_path)
    self._log((u'Destination    folder    for    this    episode:    ' + dest_path), sickrage.srCore.srLogger.DEBUG)
    make_dirs(dest_path)
    if sickrage.srCore.srConfig.RENAME_EPISODES:
        orig_extension = self.file_name.rpartition(u'.')[(-1)]
        new_base_name = os.path.basename(proper_path)
        new_file_name = ((new_base_name + u'.') + orig_extension)
    else:
        new_base_name = None
        new_file_name = self.file_name
    if (ep_obj.show.is_anime and sickrage.srCore.srConfig.ANIDB_USE_MYLIST):
        self._add_to_anidb_mylist(self.file_path)
    try:
        if (self.process_method == u'copy'):
            if isFileLocked(self.file_path, False):
                raise EpisodePostProcessingFailedException(u'File    is    locked    for    reading')
            self._copy(self.file_path, dest_path, new_base_name, sickrage.srCore.srConfig.MOVE_ASSOCIATED_FILES, (sickrage.srCore.srConfig.USE_SUBTITLES and ep_obj.show.subtitles))
        elif (self.process_method == u'move'):
            if isFileLocked(self.file_path, True):
                raise EpisodePostProcessingFailedException(u'File    is    locked    for    reading/writing')
            self._move(self.file_path, dest_path, new_base_name, sickrage.srCore.srConfig.MOVE_ASSOCIATED_FILES, (sickrage.srCore.srConfig.USE_SUBTITLES and ep_obj.show.subtitles))
        elif (self.process_method == u'hardlink'):
            self._hardlink(self.file_path, dest_path, new_base_name, sickrage.srCore.srConfig.MOVE_ASSOCIATED_FILES, (sickrage.srCore.srConfig.USE_SUBTITLES and ep_obj.show.subtitles))
        elif (self.process_method == u'symlink'):
            if isFileLocked(self.file_path, True):
                raise EpisodePostProcessingFailedException(u'File    is    locked    for    reading/writing')
            self._moveAndSymlink(self.file_path, dest_path, new_base_name, sickrage.srCore.srConfig.MOVE_ASSOCIATED_FILES, (sickrage.srCore.srConfig.USE_SUBTITLES and ep_obj.show.subtitles))
        else:
            sickrage.srCore.srLogger.error((u'Unknown    process    method:    ' + str(self.process_method)))
            raise EpisodePostProcessingFailedException(u'Unable    to    move    the    files    to    their    new    home')
    except (OSError, IOError):
        raise EpisodePostProcessingFailedException(u'Unable    to    move    the    files    to    their    new    home')
    if (sickrage.srCore.srConfig.USE_SUBTITLES and ep_obj.show.subtitles):
        for cur_ep in ([ep_obj] + ep_obj.relatedEps):
            with cur_ep.lock:
                cur_ep.location = os.path.join(dest_path, new_file_name)
                cur_ep.refreshSubtitles()
                cur_ep.downloadSubtitles()
    for cur_ep in ([ep_obj] + ep_obj.relatedEps):
        with cur_ep.lock:
            cur_ep.location = os.path.join(dest_path, new_file_name)
            cur_ep.saveToDB()
    if sickrage.srCore.srConfig.AIRDATE_EPISODES:
        for cur_ep in ([ep_obj] + ep_obj.relatedEps):
            with cur_ep.lock:
                cur_ep.airdateModifyStamp()
    ep_obj.createMetaFiles()
    History.logDownload(ep_obj, self.file_path, new_ep_quality, self.release_group, new_ep_version)
    try:
        srNotifiers.notify_download(ep_obj._format_pattern(u'%SN    -    %Sx%0E    -    %EN    -    %QN'))
        sickrage.srCore.notifiersDict[u'kodi'].update_library(ep_obj.show.name)
        sickrage.srCore.notifiersDict[u'plex'].update_library(ep_obj)
        sickrage.srCore.notifiersDict[u'emby'].update_library(ep_obj.show)
        sickrage.srCore.notifiersDict[u'synoindex'].addFile(ep_obj.location)
        sickrage.srCore.notifiersDict[u'pytivo'].update_library(ep_obj)
        sickrage.srCore.notifiersDict[u'trakt'].update_library(ep_obj)
    except:
        sickrage.srCore.srLogger.info(u'Some    notifications    could    not    be    sent.    Continuing    with    post-processing...')
    self._run_extra_scripts(ep_obj)
    return True
