<jupyter_start><jupyter_text>Colab KSO Tutorial 12: Display movies available on the serverWritten by @jannesgg and @vykantonLast updated: Jun 19, 2022  Set up and requirements  Install kso_data_management and its requirements<jupyter_code># Clone koster_data_management repo
!git clone --recurse-submodules https://github.com/ocean-data-factory-sweden/koster_data_management.git
!pip install -r koster_data_management/requirements.txt

# Restart the session to load the latest packages
exit()<jupyter_output><empty_output><jupyter_text>Import Python packages<jupyter_code># Set the directory of the libraries
import sys, os
from pathlib import Path

# Enables testing changes in utils
%load_ext autoreload
%autoreload 2

# Specify the path of the tutorials
os.chdir("koster_data_management/tutorials")
sys.path.append('..')

# Import required modules
import kso_utils.tutorials_utils as t_utils
import kso_utils.project_utils as p_utils
import kso_utils.server_utils as s_utils

print("Packages loaded successfully")<jupyter_output><empty_output><jupyter_text>Choose your project<jupyter_code>project_name = t_utils.choose_project()<jupyter_output><empty_output><jupyter_text>Initiate database<jupyter_code># Initiate db
project = p_utils.find_project(project_name = project_name.value)
db_info_dict = t_utils.initiate_db(project)<jupyter_output><empty_output><jupyter_text>Retrieve info of movies available on the server<jupyter_code>available_movies_df = s_utils.retrieve_movie_info_from_server(
    project = project,
    db_info_dict = db_info_dict
)<jupyter_output><empty_output><jupyter_text>Select the movie of interest<jupyter_code>movie_selected = t_utils.select_movie(available_movies_df)<jupyter_output><empty_output><jupyter_text>Display the movie<jupyter_code>movie_display, movie_path = t_utils.preview_movie(
    project = project,
    db_info_dict = db_info_dict, 
    available_movies_df = available_movies_df, 
    movie_i = movie_selected.value
)
movie_display
#END<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0759682224428997, 'fraction_numerical': 0.004468718967229395, 'mean_word_length': 8.035874439461884, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 1, '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}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '2165', 'license': 'MIT', 'n_tokens_mistral': 699, 'n_tokens_neox': 673, 'n_words': 140, 'path': 'colab_tutorials/COLAB_12_Display_movies_available_on_the_server.ipynb', 'repo_name': 'ocean-data-factory-sweden/koster_zooniverse', 'size': '2014'}