def player_seek_test(): controller = RemoteController("N0AA003759K70700223") player = controller.get_player_adapter() audio_folder = controller.get_remote_file("/storage/emulated/0/audio") for audio_file in audio_folder.list_files(): player.play(audio_file) player.get_duration() time.sleep(5) assert player.get_current_position() > 5000 middle_track_time = int(player.get_duration()/2) player.seek_to(middle_track_time) assert player.get_current_position() >= middle_track_time time.sleep(5) player.stop() assert not player.is_playing()
def create_delete_dirs_test(): controller = RemoteController("N0AA003759K70700223") test_dir = controller.get_remote_file("/storage/emulated/0/outer_dir/inner_dir") if not test_dir.exist(): test_dir.make_dirs() assert test_dir.exist() assert test_dir.is_directory() test_dir.delete()
def create_delete_file_test(): controller = RemoteController("N0AA003759K70700223") test_file = controller.get_remote_file("/storage/emulated/0/test.txt") if not test_file.exist(): test_file.create_new_file() assert test_file.exist() assert test_file.is_file() test_file.delete()
def player_play_stop_remote_file_test(): controller = RemoteController("N0AA003759K70700223") player = controller.get_player_adapter() audio_folder = controller.get_remote_file("/storage/emulated/0/audio") for audio_file in audio_folder.list_files(): player.play(audio_file) time.sleep(5) assert player.is_playing() player.stop() assert not player.is_playing()
def rename_file_test(): controller = RemoteController("N0AA003759K70700223") rename_file = controller.get_remote_file("/storage/emulated/0/before_rename.txt") if not rename_file.exist(): rename_file.create_new_file() assert rename_file.exist() assert rename_file.is_file() rename_file.rename_to("/storage/emulated/0/after_rename.txt") assert rename_file.get_name() == "after_rename.txt" assert rename_file.exist() assert rename_file.is_file() rename_file.delete()