Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Renamed project - changed directory name
  • Loading branch information
Javinator9889 committed Jul 1, 2018
1 parent 9339b7e commit c72c222
Show file tree
Hide file tree
Showing 28 changed files with 145 additions and 131 deletions.
2 changes: 1 addition & 1 deletion App/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion App/.idea/sqlDataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions App/messages/es_ES.json

This file was deleted.

File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions youtube_md_bot/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions youtube_md_bot/.idea/sqlDataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
183 changes: 76 additions & 107 deletions App/.idea/workspace.xml → youtube_md_bot/.idea/workspace.xml

Large diffs are not rendered by default.

File renamed without changes.
15 changes: 9 additions & 6 deletions App/application.py → youtube_md_bot/__init__.py
Expand Up @@ -6,6 +6,7 @@
from out import cPrint, Colors
from upgrader import PiPUpgrader
from database import DatabaseOperationsBase
from utils import Constants, logger
from handlers.StartHandler import StartHandler
from handlers.HelpHandler import HelpHandler
from handlers.DeveloperHandler import DeveloperHandler
Expand All @@ -21,7 +22,7 @@ def handler_definer():
from telegram.ext import CommandHandler, MessageHandler, Filters

handlers = []
with open("messages/es_ES.json", 'r') as messages_file:
with open(Constants.A_APP_MESSAGES, 'r') as messages_file:
messages: dict = messages_file.read()
start = StartHandler(messages["welcome"])
help_handler = HelpHandler(messages["help"])
Expand All @@ -30,6 +31,7 @@ def handler_definer():
url = URLHandler(messages["url_messages"])
text = TextHandler(messages["text"])
unexpected = UnexpectedHandler(messages["unexpected"])

handlers.append(CommandHandler("start", start.start))
handlers.append(CommandHandler("help", help_handler.help))
handlers.append(CommandHandler("develop", dev.develop))
Expand Down Expand Up @@ -61,9 +63,10 @@ def main(arguments: Namespace):
database_password = arguments.db_password
must_show_version = arguments.version
if must_show_version:
print("Version")
cPrint("Version: " + Constants.A_APP_VERSION + "-" + Constants.A_APP_TAG_R +
" (" + Constants.A_APP_TAG + ")", Colors.BOLD)
exit(0)
if not path.exists("app_data.dict"):
if not path.exists(Constants.A_APP_DATA_FILE):
if not token:
raise ValueError("You must add token at least the first time you execute this app")
elif not youtube_api_key:
Expand All @@ -77,7 +80,7 @@ def main(arguments: Namespace):
if not database_password:
alphabet = string.ascii_letters + string.digits
database_password = ''.join(secrets.choice(alphabet) for i in range(32))
with open("app_data.dict", "wb") as app_data_file:
with open(Constants.A_APP_DATA_FILE, "wb") as app_data_file:
app_data = {"TOKEN": token,
"YT_API": youtube_api_key,
"CREATOR_ID": creator_id,
Expand All @@ -89,11 +92,11 @@ def main(arguments: Namespace):
cPrint("Initializing bot...", Colors.GREEN)
cPrint("Looking for packages updates...", Colors.GREEN)

upgrader = PiPUpgrader("requirements.txt")
upgrader = PiPUpgrader(Constants.A_APP_REQ_FILE)
upgrader.upgradePackages()

cPrint("Obtaining values...", Colors.GREEN)
with open("app_data.dict", "rb") as app_data_file:
with open(Constants.A_APP_DATA_FILE, "rb") as app_data_file:
app_data = pickle.load(app_data_file)

cPrint("Starting database system...", Colors.GREEN)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions youtube_md_bot/messages/messages.json
@@ -0,0 +1,25 @@
{
"es_ES": [
{
"welcome": [
{
"msg": "Hola, bienvenido {} 😄\nUsa el comando /help para *obtener más ayuda* o empieza a *usar el bot* ya mismo 🎶\n\nSi quieres estar al tanto de las _últimas noticias_ sobre el bot, échale un vistazo al canal oficial: @ytMDBot"
}
],
"help": [
{
"msg": "Para descargar una canción puedes:\n ■ *Buscar* 🔎 la canción por _título y artista_, enviándoselo directamente al bot\n ■ *Enviar* directamente la _URL_ 🔗 del vídeo\n ■ Seleccionar una *canción ya descargada* desde el historial 🕒\n\n",
"more_help": "Para más ayuda, navega con los botones que aparecen debajo",
"d_via_tt-at": "*Descarga*[ ]({})canciones enviando directamente el _título_ 🎤 y _artista_ 🗣 de la canción al bot",
"d_via_url": "Comienza[ ]({})directamente *con la descarga* enviando la URL del vídeo de YouTube\n\nPuedes usar un bot _inline_ como @vid para agilizar este proceso",
"d_via_history": "Accede[ ]({})a tu *historial* mediante el comando /history, desde donde podrás _seleccionar directamente_ la canción que quieras descargar"
}
]
}
],
"en_US": [
{

}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions App/utils/__init__.py → youtube_md_bot/utils/__init__.py
Expand Up @@ -5,3 +5,10 @@ class Constants:
D_USER_DICT = {"state": 0,
"is_downloading_video": False,
"pending_videos": 0}

A_APP_VERSION = "0.2"
A_APP_TAG = "development"
A_APP_TAG_R = "d"
A_APP_DATA_FILE = "app_data.dict"
A_APP_REQ_FILE = "requirements.txt"
A_APP_MESSAGES = "messages/messages.json"
File renamed without changes.

0 comments on commit c72c222

Please sign in to comment.