Giter VIP home page Giter VIP logo

moboff's Introduction

MobOff

forthebadge

A command line tool to add your music and videos directly to several devices.

Why?

Almost all of us use youtube for our music purposes, whether it is a new single released by Eminem or an old classic by Queen.

Scenario : You need to travel the next day and you realise that the diff between your offline mobile playlist and youtube playlist is too large.

Now you have to use an online mp3 converter to convert all the songs one by one, and then connect your device via USB to paste all the music. That too without the metadata.

There is a need for a tool which would directly download and convert the video, add available metadata and send it to your device, all at the same time.

Enters MobOff.

Features

  • Download the best available audio, or video (by --video option) in common mobile player compatible extensions.
  • Playlists can also be downloaded.
  • Adds metadata automatically from the title.
  • Add a preffered device to send music, or override it with --newdevice option.
  • Delete the downloaded video/music file from the computer via --delete option.
  • Send the downloaded video/music file to your friends via the --send option.

How to use?

(Tested on Ubuntu with Python 3)

The initial setting up of the Pushbullet account seems a little tiring but it is just a one-time setup, and the gains are endless.

  1. You need a Pushbullet account to send the files.

Pushbullet is a great tool for sending text messages, links, files and seeing phone's notifications on your computer.

  • Create your account on it using your Google or Facebook login.
  • Install the Pushbullet App on your iOS or Android device.
  • Install the Chrome/Firefox extension for Pushbullet on your computer.

You can skip the following steps if you have Docker installed on your machine. See how to run using docker instructions

  1. You need to install ffmpeg and tkinter.
  • Installing ffmpeg : sudo apt-get install ffmpeg
  • Installing tkinter( for python3 users ) : sudo apt-get install python3-tk
  • Installing tkinter( for python2 users ) : sudo apt-get install python-tk
  1. After setting Pushbullet up, you need to install MobOff.

It is recommended that you use virtualenv (especially for conda users).

  • Installing virtualenv : sudo pip install virtualenv
  • virtualenv venv --python=python3
  • . venv/bin/activate
  • python setup.py install
  1. You need to initialise with some of your information.
  • Run moboff initialise
  • Obtain your Pushbullet API key via Pushbullet Settings by clicking on "Create Access Token" button.
  • Enter the serial number for your preffered device to send the music/video files to when asked to.
  • When prompted enter the directory in which you want the downloaded files should be stored.

You're all set up.

GIFs to demonstrate the installation

Installation of the dependencies

Feeding the data, url for download. Ultimately, the links have been sent to your Computer and Android phone.

With Docker

Follow this instructions to install Docker if it is not installed.

Pull Docker image from Docker Hub and start the container

Make sure you are logged into Docker Hub from your command line by running docker login. The Docker Hub repository is here. Now run the following commands

$ docker pull ashwani99/moboff

# disable access control for X11 server
$ xhost +

# run the container
$ docker run -it -rm -e DISPLAY=$DISPLAY \
             -v /tmp/.X11-unix:/tmp/.X11-unix \
             ashwani99/moboff

# run moboff
$ moboff

# press Ctrl+C to stop the running container

Locally build the image and start a container

# build the docker image
$ docker build -t moboff .

# disable access control for X11 server
$ xhost +

# run the container
$ docker run -it -e DISPLAY=$DISPLAY \
             -v /tmp/.X11-unix:/tmp/.X11-unix \
             moboff

# run moboff
$ moboff

# press Ctrl+C to stop the running container

Usage

moboff --help

Usage: moboff [OPTIONS] COMMAND [ARGS]...

  A command line tool to download, convert and send youtube videos or
  playlists to your device via Pushbullet.

  You need to install Pushbullet in all your devices for this to work.

  If this is your first time using this, please run `moboff initialise` to
  add required information.

  Run `moboff download --help` to know about various options while
  downloading and sending.

Options:
  --help  Show this message and exit.

Commands:
  download    Downloads and sends the video
  initialise  Initialise with info

moboff download --help

Usage: moboff download [OPTIONS]

  Download a youtube video or playlist in best audio and video quality by
  providing a link, and then send to the preffered device, or override it
  with `--newdevice` option.

  Provide the device name for `--newdevice` in quotes for e.g. "OnePlus
  One".

  Please run `moboff initialise` if this is your first time.

Options:
  --link TEXT       Paste the link here to download and send to your device
  --newdevice TEXT  Overwrite the saved device
  --video           Send the video file instead of mp3 file.
  --delete          Delete the music file after sending.
  --send            Send the file to a friend.
  --help            Show this message and exit.

moboff initialise --help

Usage: moboff initialise [OPTIONS]
  
  Initialise the program with your API key and preferred device.
  
Options:
  --help  Show this message and exit.

Contribute

This is a very young project. If you have got any suggestions for new features or improvements, please comment over here. Pull Requests are most welcome !

forthebadge

Logo Credits : Divya Sharma.

moboff's People

Contributors

ashwani99 avatar ilozuluchris avatar karunagoyalk avatar klowner avatar parth-vader avatar sayem314 avatar vishesh98 avatar yash98 avatar yashrsharma44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

moboff's Issues

Download Playlist feature doesn't send entire playlist to the device.

Downloading Playlist feature downloads playlist but doesn't push all files to devices. It only selects file with max c time(for multiple max the first one encountered) that is the most recent download. It can be seen in this snippet.

    list_of_files = []
    for files in types:
        list_of_files.extend(glob.glob(files))
    recent_download = max(list_of_files,  key=os.path.getctime) # only selects 1 file
    print("File to send : {0}".format(recent_download))```

Missing dependencies file

The project directory is missing a dependency file requirements.txt. We should add a dependency file that includes all the dependencies the project needs. Also update the setup.py script to read the dependencies from requirements.txt

Improved CLI support to pass API key & Device Id

We need to improve the CLI support for moboff initialise & moboff download in such a way that, we should be able to initialise using moboff initialize --api <key> --device <device_id> or moboff download --api <key> --device <device_id> --link <link>

This will come in handy in #60 & #61

help for my idea

hello, I'm taking a cue from your project to get me the mp3 file downloaded from youtube dl on my phone using this:
def download(phrase):
subprocess.Popen(["/usr/bin/youtube-dl",'-o','Music/%(title)s.%(ext)s','--batch-file','lista.txt','--extract-audio','--audio-format=mp3'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)
say("download della traccia in corso")
with open(home/pi/Music/file.mp3, "rb") as song:
file_data = pb.upload_file(song, home/pi/Music/file.mp3)
push = pb.push_file(**file_data)
I have a youtube url saved in the file list.txt that is recovered from youtube dl and extracts the mp3 file in the Music folder of my raspberry
how should I change this piece of code?
with open(file, "rb") as song:
file_data = pb.upload_file(song, file)
push = pb.push_file(**file_data)

I specify that in my py script I have declared my apy key pushbullet and if I insert the title of a single mp3 I will be sent correctly.
what I intend to do is that when the dowload function is called, the process of extracting and sending the mp3 file to my cellphone automatically starts without having to do it programmatically every time

Browser Extension

Javascript plugin which if you click on when on YouTube, it will automatically copy the url and send moboff download --link url. That way, it will all be a seamless process where whenever you want to download a song, you click on the extension and it automatically does the background work.

It is not possible to run system commands outside the browser so a workaround needs to be used.

Missing gitignore file

We should add a .gitignore file so that Git can neglect the virtual environment directory, egg files etc

What is the use?

Too many things are to be done to use this app. Simplification and merging steps into one and automating many steps will be very useful. Example

Publishing a Docker image to DockerHub

This will be a extension to #60 . With a Docker image published to DockerHub, the user should be able to

  1. Pull the image
  2. Run the container with the moboff download flags appended to docker run and convert a file at one go without having to install anything else

Song suggestions

Suggest some songs to the user based on the artist whose song was just downloaded.

Not working in Ubuntu 16.04

Traceback (most recent call last):
  File "/usr/local/bin/moboff", line 9, in 
    load_entry_point('MobOff==0.1', 'console_scripts', 'moboff')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named 'mainscript'

.idea file gets tracked too

If someone will open the project in IntelliJ or any other IDE, the .idea file which is created gets tracked too. Just adding it to .gitignore solved the issue.
Thought it would be proper to report it first and then send the PR.

Python 2 and 3 compatibility fix was only for initialise

if version_info[0] == 2: rawinput = raw_input else: rawinput = input
In some previous commit this was added to make code compatible for both python 2 and 3 this was done in scope of function initialise only, but this could be done in global scope.

Uncaught exceptions at various lines

lines like

  • os.chdir(directory) uses directory from the previous moboff initialise. If the directory doesnt exist anymore throws exception

  • pb = Pushbullet(api_key) not check whether api_key exists or not

These exception could be handle by asking user to rerun moboff initialise and exiting or changes to moboff_cfg.json at the time of catching exception. Which of these two or something else entirely seems better?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.