diff --git a/app/anotations/0.txt b/app/anotations/0.txt new file mode 100644 index 0000000..0cd8a0f --- /dev/null +++ b/app/anotations/0.txt @@ -0,0 +1,2 @@ +game: 0 +player1 / player2 diff --git a/app/games/board.png b/app/games/board.png new file mode 100644 index 0000000..314b85a Binary files /dev/null and b/app/games/board.png differ diff --git a/app/locales/ca.txt b/app/locales/ca.txt new file mode 100644 index 0000000..0c1dae6 --- /dev/null +++ b/app/locales/ca.txt @@ -0,0 +1,58 @@ +search_end: fi +search_move: mou +search_new: nova +search_games: jocs +search_send: envia +search_help: ajuda +new_game_started: partida iniciada! Esperant jugador... +playing_with: jugues amb +your_turn: el teu torn +game_name: partida +chess_hashtag: #escacs +send_error: error al enviar les anotacions :-( +game_number_anotations: les anotacions de la partida n. +anotations_sent: enviades amb èxit! +game_no_exists: la partida n. +cant_send_to_fediverse_account: per ara no és possible :-( +it_not_exists: no existeix... +game_already_started: ja tenies iniciada una partida! +wait_other_player: espera l'altre jugador +is_not_legal_move: és un moviment il·legal. Torna a tirar. +check_done: t'ha fet escac! +check_mate: Escac i mat! (en +check_mate_movements: moviments) +the_winner_is: El guanyador és: +well_done: ben jugat! +winned_games: Partides guanyades: +wins_of_many: de +lost_piece: * has perdut +not_legal_move_str: moviment il·legal! +player_leave_game: ha deixat la partida amb +leave_waiting_game: has abandonat la partida en espera. +started_games: partides iniciades: +game_is_waiting: en espera... +game_is_on_going: (en joc) +no_on_going_games: cap partida en joc +is_not_your_turn: no és el teu torn. +is_the_turn_of: és el torn de +pawn_piece: un peó +knight_piece: un cavall +bishop_piece: l'alfil +rook_piece: una torre +queen_piece: la Dama +king_piece: el Rei +pawn_piece_letter: P +knight_piece_letter: C +bishop_piece_letter: A +rook_piece_letter: T +queen_piece_letter: D +king_piece_letter: R +email_subject: Anotacions partida n. +start_or_join_a_new_game: nova (iniciar partida o unirse a una en espera) +move_a_piece: mou e2e3 (per exemple) +leave_a_game: fi (per a deixar la partida en qualsevol moment) +list_games: jocs (mostra un llistat de partides actives) +get_a_game_anotation: envia 1 (1 és el número de la partida. Envia les anotacions de la partida per correu electrònic, només usuaris del servidor local) +show_help: ajuda (mostra aquesta ajuda i, per tant, és l'ajuda de l'ajuda) + + diff --git a/app/locales/en.txt b/app/locales/en.txt new file mode 100644 index 0000000..f94a778 --- /dev/null +++ b/app/locales/en.txt @@ -0,0 +1,58 @@ +search_end: end +search_move: move +search_new: new +search_games: games +search_send: send +search_help: help +new_game_started: game started! Waiting for the second player... +playing_with: you play with +your_turn: it's your turn +game_name: game +chess_hashtag: #chess +send_error: sending anotations error :-( +game_number_anotations: the anotations of game n. +anotations_sent: succesfully sent! +game_no_exists: the game n. +cant_send_to_fediverse_account: not possible yet :-( +it_not_exists: don't exists... +game_already_started: you already started a game! +wait_other_player: wait for the second player +is_not_legal_move: is not a legal move. Play again. +check_done: you are in check! +check_mate: it's a checkmate! (in +check_mate_movements: moves) +the_winner_is: The winner is: +well_done: well done! +winned_games: Won games: +wins_of_many: of +lost_piece: * you have lost +not_legal_move_str: not a legal move! +player_leave_game: has left the game with +leave_waiting_game: you have left the game in hold. +started_games: started games: +game_is_waiting: on hold... +game_is_on_going: (on going) +no_on_going_games: no games +is_not_your_turn: it's not your turn. +is_the_turn_of: it's the turn of +pawn_piece: a pawn +knight_piece: one knight +bishop_piece: one bishop +rook_piece: a rook +queen_piece: the Queen +king_piece: the King +pawn_piece_letter: P +knight_piece_letter: N +bishop_piece_letter: B +rook_piece_letter: R +queen_piece_letter: Q +king_piece_letter: K +email_subject: Anotations of game n. +start_or_join_a_new_game: new (start a new game or join a waiting one) +move_a_piece: move e2e3 (in ex.) +leave_a_game: end (to leave the game any time) +list_games: games (show an on going games list) +get_a_game_anotation: send 1 (1 is the game number. It send the game's anotations by email but local users only) +show_help: help (show this help so, it's the help of the help) + + diff --git a/app/locales/es.txt b/app/locales/es.txt new file mode 100644 index 0000000..0464870 --- /dev/null +++ b/app/locales/es.txt @@ -0,0 +1,58 @@ +search_end: fin +search_move: mueve +search_new: nueva +search_games: partidas +search_send: envia +search_help: ayuda +new_game_started: partida iniciada! Esperando jugador... +playing_with: juegas con +your_turn: tu turno +game_name: partida +chess_hashtag: #ajedrez +send_error: error al enviar las anotaciones :-( +game_number_anotations: las anotaciones de la partida n. +anotations_sent: enviades con éxito! +game_no_exists: la partida n. +cant_send_to_fediverse_account: por ahora no es posible :-( +it_not_exists: no existe... +game_already_started: ja tenias iniciada una partida! +wait_other_player: espera al otro jugador +is_not_legal_move: es un movimiento ilegal. Vuelve a tirar. +check_done: te ha echo jaque! +check_mate: Jaque mate! (en +check_mate_movements: movimientos) +the_winner_is: El ganador es: +well_done: bien jugado! +winned_games: Partidas ganadas: +wins_of_many: de +lost_piece: * has perdido +not_legal_move_str: movimiento ilegal! +player_leave_game: ha dejado la partida con +leave_waiting_game: has abandonado la partida en espera. +started_games: partidas iniciadas: +game_is_waiting: en espera... +game_is_on_going: (en juego) +no_on_going_games: ninguna partida en juego +is_not_your_turn: no es tu turno. +is_the_turn_of: es el turno de +pawn_piece: un peón +knight_piece: un caballo +bishop_piece: el alfil +rook_piece: una torre +queen_piece: la Dama +king_piece: el Rey +pawn_piece_letter: P +knight_piece_letter: C +bishop_piece_letter: A +rook_piece_letter: T +queen_piece_letter: D +king_piece_letter: R +email_subject: Anotaciones partida n. +start_or_join_a_new_game: nueva (empezar una partida o unirse a una en espera) +move_a_piece: mueve e2e3 (por ejemplo) +leave_a_game: fin (para dejar la partida en cualquier momento) +list_games: partidas (muestra un listado de partidas activas) +get_a_game_anotation: envia 1 (1 es el número de la partida. Envia las anotaciones de la partida pedida por correo electrónico pero sólo a usuarios del servidor local) +show_help: ayuda (muestra esta ayuda y, por tanto, es la ayuda de la ayuda) + + diff --git a/mastochess.py b/mastochess.py index bb43bbd..f5ac4d6 100644 --- a/mastochess.py +++ b/mastochess.py @@ -529,7 +529,7 @@ def save_anotation(moving): moving = moving + 'q' - game_file = "anotations/" + str(game_id) + ".txt" + game_file = "app/anotations/" + str(game_id) + ".txt" if moved_piece_name == 'P': @@ -655,7 +655,7 @@ def send_anotation(game_id): msg['Subject'] = email_subject + game_id # Attach the game anotation - file_to_attach = "anotations/" + game_id + ".txt" + file_to_attach = "app/anotations/" + game_id + ".txt" try: attachment = open(file_to_attach, 'rb') @@ -1202,12 +1202,6 @@ def get_parameter( parameter, file_path ): print(file_path + " Missing parameter %s "%parameter) sys.exit(0) -def create_dir(): - if not os.path.exists('games'): - os.makedirs('games') - if not os.path.exists('anotations'): - os.makedirs('anotations') - def usage(): print('usage: python ' + sys.argv[0] + ' --play' + ' --en') @@ -1242,15 +1236,15 @@ if __name__ == '__main__': if bot_lang == 'ca': - language_filepath = 'locales/ca.txt' + language_filepath = 'app/locales/ca.txt' elif bot_lang == 'en': - language_filepath = 'locales/en.txt' + language_filepath = 'app/locales/en.txt' elif bot_lang == 'es': - language_filepath = 'locales/es.txt' + language_filepath = 'app/locales/es.txt' else: @@ -1300,8 +1294,6 @@ if __name__ == '__main__': now = datetime.now() - create_dir() - bot_id = get_bot_id() account_id_lst, status_id_lst, text_lst, visibility_lst, url_lst = get_notification_data() @@ -1321,18 +1313,12 @@ if __name__ == '__main__': replied = check_replies(status_id) - if replied == True: #or domain != None: + if replied == True: i += 1 continue - #if domain != None: - - #update_replies(username, status_id) - - #i += 1 - # listen them or not text = text_lst[i] @@ -1363,7 +1349,7 @@ if __name__ == '__main__': svgfile = chess.svg.board(board=board) - board_file = 'games/' + str(game_id) + '_board.png' + board_file = 'app/games/' + str(game_id) + '_board.png' svg2png(bytestring=svgfile,write_to=board_file) @@ -1393,7 +1379,7 @@ if __name__ == '__main__': svgfile = chess.svg.board(board=board) - board_file = 'games/' + str(game_id) + '_board.png' + board_file = 'app/games/' + str(game_id) + '_board.png' svg2png(bytestring=svgfile,write_to=board_file) @@ -1481,7 +1467,7 @@ if __name__ == '__main__': svgfile = chess.svg.board(board=board) - board_file = 'games/' + str(game_id) + '_board.png' + board_file = 'app/games/' + str(game_id) + '_board.png' svg2png(bytestring=svgfile,write_to=board_file) @@ -1633,7 +1619,7 @@ if __name__ == '__main__': svgfile = chess.svg.board(board=board, orientation=chess.WHITE, lastmove=chess.Move.from_uci(moving)) - board_file = 'games/' + str(game_id) + '_board.png' + board_file = 'app/games/' + str(game_id) + '_board.png' svg2png(bytestring=svgfile,write_to=board_file) @@ -1822,7 +1808,7 @@ if __name__ == '__main__': svgfile = chess.svg.board(board=board, orientation=chess.WHITE) - board_file = 'games/' + str(game_id) + '_board.png' + board_file = 'app/games/' + str(game_id) + '_board.png' svg2png(bytestring=svgfile,write_to=board_file)