<commit_before>import os
import shelve
from nestedict import  Nestedict

from vlc import  MediaPlayer, MediaListPlayer, MediaList
import config
NOTFOUND = "Not Found"

class Player:
    def __init__(self, dirs=[]):
        assert(isinstance(dirs, list) == True)
        self.dirs = dirs
        self.load_directories()
        self.add_directory(config.url_location)
        self.add_directory(config.playlist_location)
        self.add_directory(config.uploaded_location)
        self.player = None


    def __del__(self):
        if self.player is not None:
            self.player.stop()

    def load_directories(self):
        d = shelve.open(config.player_persistance)
        for dr in d["dirs"]:
            self.add_directory(dr)
        d.close()

    def save_directories(self):
        d = shelve.open(config.player_persistance)
        d["dirs"] = self.get_directory()
        d.sync()
        d.close()

    def found_entry(self, entry):
        try:
            if entry.rsplit(".", 1)[1] == "url":
                return open(os.path.join(config.url_location, entry)).read().strip("\n")
            for directory in self.dirs:
                if entry in os.listdir(directory):
                    return os.path.join(directory, entry)
        except:
            return None
        return None
<commit_msg>Fix Check if path exists: 	check if load directories can be done properly<commit_after>import os
import shelve
from nestedict import  Nestedict

from vlc import  MediaPlayer, MediaListPlayer, MediaList
import config
NOTFOUND = "Not Found"

class Player:
    def __init__(self, dirs=[]):
        assert(isinstance(dirs, list) == True)
        self.dirs = dirs
        self.load_directories()
        self.add_directory(config.url_location)
        self.add_directory(config.playlist_location)
        self.add_directory(config.uploaded_location)
        self.player = None


    def __del__(self):
        if self.player is not None:
            self.player.stop()

    def load_directories(self):
        if not os.path.exists(config.player_persistance):
            return
        d = shelve.open(config.player_persistance)
        for dr in d["dirs"]:
            self.add_directory(dr)
        d.close()

    def save_directories(self):
        d = shelve.open(config.player_persistance)
        d["dirs"] = self.get_directory()
        d.sync()
        d.close()

    def found_entry(self, entry):
        try:
            if entry.rsplit(".", 1)[1] == "url":
                return open(os.path.join(config.url_location, entry)).read().strip("\n")
            for directory in self.dirs:
                if entry in os.listdir(directory):
                    return os.path.join(directory, entry)
        except:
            return None
        return None

{'fraction_non_alphanumeric': 0.10297811266594904, 'fraction_numerical': 0.0014352350197344816, 'mean_word_length': 2.2082853855005755, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4952564', 'n_tokens_mistral': 833, 'n_tokens_neox': 813, 'n_words': 192}