28

How can I install Popcorn Time beta ?

I see on their website that they only offer a 64-bit installation files, but the sources are open.

I can't use the usual ./configure && make. So, what can I do ?

6
  • I'm on 64 bit xubuntu 14.04, I downloaded the beta 3.0 package from their site, unzipped it and ran ./Popcorn-Time it's been like 20 min, it's saying initializing popcorn please wait.... Will it work eventually or should I follow your instructions to get it working instead of waiting?
    – Lynob
    May 20, 2014 at 15:32
  • it won't work, initializing takes about 0,3sec for me. The problem must be elsewhere, I don't see how this would change from official release instead that it's based on development code (alpha). Report issues : github.com/popcorn-official/popcorn-app/issues
    – MrVaykadji
    May 20, 2014 at 16:00
  • I did try to follow your second answer, tried to fix the python file, hoping to fix the errors, didn't work, I followed your first answer and it worked thank you. please note that it would be nice if you could edit your script to check if the dependencies are installed, I installed them before running your script, still your script took 5 min trying to install them, it could easily skip that part. And please remove the install all option as one can't run mac and win and linux at the same time, this option just waste time, no one can use it
    – Lynob
    May 20, 2014 at 19:08
  • Uh, why couldn't one have a macbook air and a PC with ubuntu-windows? That's the all point of 'option', being able to choose. You shouldn't type "all" if you don't want "all" to be build. For the dependencies, if you are talking about nodejs and already having it, you'll only go through a 'apt-get update', no big deal. If you're talking about npm dependencies, then they have to be installed inside the folder when we'll use it, not somewhere else on the computer : so it's necessary.
    – MrVaykadji
    May 20, 2014 at 19:11
  • but they already have packages on their website for windows and mac. aren't they working? do they need to be built just like linux package?
    – Lynob
    May 20, 2014 at 19:28

2 Answers 2

21

This script will help you build Popcorn Time dev-0.3 on Ubuntu Linux from the Github sources.

It works flawlessly on Ubuntu 12.04 and 14.04 64bits, but should work with every maintained version and every architecture.

To build and install Popcorn-Time from sources, you'll need nodejs and npm. npm uses bower and grunt-cli to build the files: that's why you can't use the usual ./configure

Note : there currently is 1 bug with the installation files : nodejs binary being misnamed, you can fix it by a simple symlink from 'nodejs' to 'node'.

Note : on 12.04, there's no libudev.so.1, so we'll need to symlink it from libudev.so.0

HOW-TO

  1. Copy-paste the following lines into a text file, I'll name it script for the example.

  2. Then, use your terminal and launch the script:

    bash script
    
  3. Follow the instructions on the screen:

    • Accept the disclaimer
    • Choose the plateform you want to build for (mac,win,linux32-64)
    • Install Popcorn-Time with shortcuts and commandline options if you wish
    • Remove building files if you don't want them anymore
    • Remove the packages used by this script to build PT if you don't want them in the future
    • voila.

This will take about 10-30min to complete.


#!/bin/bash
#Written by MrVaykadji - http://github.com/MrVaykadji
#Thanks to Andrew for func_apt, nodejs PPA and libudev fix - http://webupd8.org
#licensed under GPLv3
#for Ubuntu 12.04 and newer

installdir="/opt"
version="master"
OfficialURL="http://popcorntime.io"
githubURL="https://github.com/popcorn-official/popcorn-app"
issueURL="https://github.com/popcorn-official/popcorn-app/issues"
icon="https://github.com/popcorn-official/popcorn-app/raw/master/src/app/images/icon.png"
log="$HOME/popcorn-build.log"
buildscriptURL="https://raw.githubusercontent.com/MrVaykadji/misc/master/Popcorn-Time/0.3.0/"
buildscript="build-popcorn"
[ $(arch) == "x86_64" ] && arch=64 || arch=32
buildtime="`date +%Y.%m.%d-%Hh%M`"

#FUNCTIONS
func_apt() {
for lock in synaptic update-manager software-center apt-get "dpkg " aptitude
do
 if ps -U root -u root u | grep "$lock" | grep -v grep > /dev/null; then 
  echo "
Unexpected Error:
=================
Please close $lock then try again.";
  exit 1
 fi
done 
}

func_root() {
[ "$EUID" == "0" ] && 
echo "Error. You need to run this without 'root' or 'sudo' privileges." && 
exit 2
}

func_error() {
[ -n $error ] && return 0
echo "
Unexpected Error:
================="
cat $log
echo "
Please try again."
exit 1 
}

func_clean() {
case $1 in 
    -save)
        sudo mkdir -p /tmp/popcorn-config
        sudo cp -r $HOME/.config/Popcorn-Time/data /tmp/popcorn-config/ &> /dev/null
        sudo rm -rf $HOME/.config/Popcorn-Time/*
        sudo cp -r /tmp/popcorn-config/data $HOME/.config/Popcorn-Time/ &> /dev/null && 
        sudo chown -Rf $USER:$USER $HOME/.config/Popcorn-Time/data && 
        sudo chmod -R 774 $HOME/.config/Popcorn-Time/data
        ;;
    -all)
        sudo rm -rf $installdir/Popcorn-Time /usr/share/pixmaps/popcorntime.png /usr/bin/popcorn-time $HOME/tmp $HOME/popcorn-app-$version $HOME/npm-debug.log $HOME/.npm $HOME/.cache/bower $HOME/.config/configstore/insight-bower.yml $HOME/.config/configstore/update-notifier-bower.yml $HOME/.local/share/bower $log $HOME/$version.zip $HOME/.npm/
        ;;
    -package)
        sudo apt-get purge nodejs -y &> /dev/null && 
        sudo apt-get autoremove -y &> /dev/null && 
        sudo rm -rf /usr/bin/node && 
        sudo add-apt-repository -yr ppa:chris-lea/node.js &> /dev/null && 
        echo -e "... Done.\n" 
        ;;
    -building)
 sudo rm -rf $HOME/tmp $HOME/popcorn-app-$version $HOME/npm-debug.log $HOME/.npm $HOME/.cache/bower $HOME/.config/configstore/insight-bower.yml $HOME/.config/configstore/update-notifier-bower.yml $HOME/.local/share/bower $log $HOME/.npm && 
        echo -e "... Done.\n"
        ;;
esac
}

func_ptexists() {
if [ "$1" == "-update" ] ; then
    func_clean -save
else
    [ -e "$installdir/Popcorn-Time" ] && 
    read -p "
WARNING: Popcorn-Time is already installed in '$installdir' and will be erased. Do you want to keep the configuration files (bookmarks, watched list, settings, ...) [y/n] ? "
    if [ "$REPLY" == "y" ] ; then
        func_clean -save
    else    
        sudo rm -rf $HOME/.config/Popcorn-Time/
    fi
    sudo rm -rf /usr/share/applications/popcorn-time.desktop
fi
func_clean -all
}

func_dependencies() {
#package dep
[[ -n `egrep -v '^#|^ *$' /etc/apt/sources.list /etc/apt/sources.list.d/* | grep chris-lea/node.js` ]] && nodeppa=1 || nodeppa=0
if [ -n "`dpkg-query -W -f='${Status}\n' nodejs wget unzip | grep not`" ] || [ $nodeppa == "0" ] ; then
    echo "- Checking for dependencies 'nodejs', 'wget' and 'unzip'..."
    sudo apt-add-repository -y ppa:chris-lea/node.js &> $log && 
    sudo apt-get update &> $log

    sudo apt-get install nodejs wget unzip -y &> $log && echo -e "  ...Ok !" || error=1
    func_error
fi

#npm dep
if [ -e "/usr/lib/node_modules/bower" ] && [ -e "/usr/lib/node_modules/grunt-cli" ] ; then
    echo -e "\n- Updating NPM 'grunt-cli' and 'bower'..."
else
    echo -e "\n- Installing NPM 'grunt-cli' and 'bower'..."
fi
sudo npm install -g grunt-cli bower &> $log && echo -e "  ...Ok !\n" || error=1
func_error

#repair broken nodejs symlink
[ ! -e /usr/bin/node ] && sudo ln -s /usr/bin/nodejs /usr/bin/node 

#symlink libudev.so on 12.04
[ `lsb_release -cs` == "precise" ] && [ ! -e /lib/$(arch)-linux-gnu/libudev.so.1 ] && sudo ln -s /lib/$(arch)-linux-gnu/libudev.so.0 /lib/$(arch)-linux-gnu/libudev.so.1 
}

func_build() {
#get sources
echo "- Downloading sources (branch:$version) from GitHub..."
cd
wget $githubURL/archive/$version.zip -O $version.zip &> $log && unzip -o $version.zip &> $log && rm $version.zip && echo -e "  ...Ok !\n" || error=1
func_error

#npm
cd popcorn-app-$version
echo "- Running 'npm install'..."
sudo chown -Rf $USER:$USER $HOME/popcorn-app-$version/ $HOME/tmp $HOME/.npm
npm install --yes &> $log && echo -e "  ...Ok !\n" || error=1
func_error

#build
if [ "$1" == "-update" ] ; then
 buildcommand="linux$arch"
else
 buildvar=0
 echo -e "You can build for this machine only (linux$arch) or for all platforms, including : Mac, Windows, Linux 32-bits, Linux 64-bits.\n\nFor what platforms do you wish to build (for multiple builds, separate each platform with a comma)"
 read -p "[mac/win/linux32/linux64/all] : " input
 IFS=',' read -a options <<< "$input"
 shopt -s extglob
 for option in "${options[@]}"; do
    case "$option" in
        win|mac|linux32|linux64|all)
            buildcommand="${buildcommand:+$buildcommand,}$option"
            buildvar=1;;
        *)
            printf 'Invalid option "%s" ignored.\n' "$option";;
    esac
 done
 if (( !buildvar )); then
    echo "Incorrect input. Default build 'linux$arch' selected."
    buildcommand="linux$arch"
 fi
 [[ -n "`echo $buildcommand | grep all`" ]] && buildcommand="all"
fi

echo -e "\n- Building with 'grunt'..."
grunt build --platforms=$buildcommand &> $log && echo -e "   ...Ok !\n" || error=1
func_error

echo -e "Popcorn-Time has been built in :\n  «$HOME/popcorn-app-$version/build/releases/Popcorn-Time/»\n" 
}

func_install() {
[ "`echo $buildcommand | grep -v linux$arch`" ] && exit 0

if [ "$1" != "-update" ] ; then
read -p "Do you wish to install Popcorn-Time on this computer [y/n] ? "
[ "$REPLY" != "y" ] && exit 0
fi  

sudo mkdir -p $installdir
sudo cp -r $HOME/popcorn-app-$version/build/releases/Popcorn-Time/linux$arch/Popcorn-Time $installdir

echo -e "\n- Creating commandline launcher..."
echo "#!/bin/bash
echo \"Popcorn Time
============\"

[ \"\$EUID\" == \"0\" ] && echo \"Error: You need to run this without 'root' or 'sudo' privileges.\" && exit 2

helpsection() {
echo \"Version $version 
Built on $buildtime from $githubURL
Official website : $OfficialURL

Options:
  -h, --help        Display this help.
  -q,--quiet        Launch Popcorn-Time without output.
  --flush       Flush databases.
  --fix-node        Fix the node-webkit 'blank' error.
  --uninstall       Uninstall Popcorn-Time.
  --issue       Report an issue.
  --build       Build latest version from sources.\"
}

flush_all() {
echo \"- Flushing databases...\"
sudo rm -rf $HOME/.config/Popcorn-Time
}

uninstall() {
echo \"- Uninstalling Popcorn-Time and removing configuration files...\"
sudo bash $installdir/Popcorn-Time/uninstall.sh
}

popcorntimequiet() {
echo \"Starting...\"
nohup $installdir/Popcorn-Time/Popcorn-Time &> /dev/null &
exit 0
}

popcorntime() {
$installdir/Popcorn-Time/Popcorn-Time
}

reportissue() {
echo \"Here is what a great bug report looks like:


###############################
Describe the problem here

Version: $version for Linux $arch bits
         Built on $buildtime
Downloaded from: $githubURL
OS: `lsb_release -si` `lsb_release -sr` `arch`
Connection: X mbps

How to reproduce:
 - Step 1
 - Step 2
 - Step 3
Actual result:
 - X goes wrong
Expected result:
 - X should go like that
###############################\"
xdg-open $issueURL &> /dev/null
}

fix_node() {
echo \"Fixing node-webkit...\"
rm -rf $HOME/.config/node-webkit
}

build_pt() {
cd
echo \"Building script fetched from GitHub...\"
wget -q $buildscriptURL$buildscript
bash $buildscript -update
}

case \$1 in
    -h|--help)
        helpsection
        ;;
    --uninstall)
        uninstall
        ;;
    --flush)
        flush_all
        ;;
    --fix-node)
        fix_node
        ;;
    --issue)
        reportissue
        ;;
    -q|--quiet)
        popcorntimequiet
        ;;
    --build)
        build_pt
        ;;
    *)
        popcorntime
        ;;
esac" | sudo tee /usr/bin/popcorn-time &> /dev/null
sudo chmod +x /usr/bin/popcorn-time
echo -e "    «/usr/bin/popcorn-time»\n"

echo "- Creating launcher... "
sudo wget $icon -qO /tmp/popcorntime.png && sudo cp /tmp/popcorntime.png /usr/share/pixmaps/
echo "[Desktop Entry]
Comment=Watch movies in streaming with P2P.
Comment[fr]=Regarder des films en streaming.
Name=Popcorn Time
Exec=/usr/bin/popcorn-time
StartupNotify=false
Type=Application
Icon=popcorntime
Actions=ForceClose;ReportIssue;FlushDB;FixNode;BuildUpdate;
Keywords=P2P;streaming;movies;tv;series;shows;
Keywords[fr]=P2P;streaming;films;séries;télévision;tv;

[Desktop Action ForceClose]
Name=Force close
Name[fr]=Forcer la fermeture
Exec=killall Popcorn-Time
OnlyShowIn=Unity;

[Desktop Action ReportIssue]
Name=Report Issue
Name[fr]=Rapporter un problème
Exec=sh -c \"popcorn-time --issue\"
OnlyShowIn=Unity;

[Desktop Action FlushDB]
Name=Flush databases
Name[fr]=Vider les bases de données
Exec=sh -c \"killall Popcorn-Time ; rm -rf $HOME/.config/Popcorn-Time ; /usr/bin/popcorn-time\"
OnlyShowIn=Unity;

[Desktop Action FixNode]
Name=Fix Node-Webkit
Name[fr]=Réparer Node-Webkit
Exec=sh -c \"rm -rf $HOME/.config/node-webkit ; killall Popcorn-Time ; /usr/bin/popcorn-time\"
OnlyShowIn=Unity;

[Desktop Action BuildUpdate]
Name=Build latest version
Name[fr]=Construire la dernière version
Exec=sh -c 'killall Popcorn-Time ; xterm -fa monaco -fs 13 -bg black -fg white -title \"Build latest Popcorn Time\" -e \"popcorn-time --build\" ; /usr/bin/popcorn-time'
OnlyShowIn=Unity;" | sudo tee /usr/share/applications/popcorn-time.desktop &> /dev/null
sudo chmod +x /usr/share/applications/popcorn-time.desktop
echo -e "    «/usr/share/applications/popcorn-time.desktop»\n"

echo "- Creating uninstall script..."
echo "#!/bin/bash
#uninstallation script for Popcorn-Time

#clean directory
sudo rm -rf $installdir/Popcorn-Time

#clean config
sudo rm -rf $HOME/.config/Popcorn-Time

#clean icon
sudo rm -rf /usr/share/pixmaps/popcorntime.png

#clean launchers
sudo rm -rf /usr/bin/popcorn-time
sudo rm -rf /usr/share/applications/popcorn-time.desktop
" | sudo tee $installdir/Popcorn-Time/uninstall.sh &> /dev/null
sudo chmod +x $installdir/Popcorn-Time/uninstall.sh
echo -e "    «$installdir/Popcorn-Time/uninstall.sh»\n" 
}

func_end() {
if [ "$buildcommand" == "linux$arch" ] ; then
 if [ "$1" == "-update" ] ; then
    func_clean -building
    sudo rm -rf $0
 else
  read -p "Do you wish to remove all the building files [y/n] ? "
  [ "$REPLY" == "y" ] && func_clean -building
 fi
fi

if [ "$nodeppa" == "0" ] ; then
    read -p "Do you wish to uninstall the packages installed for this build, they will be needed in case of new build [y/n] ? "
    [ "$REPLY" == "y" ] && func_clean -package
fi 
}

#SCRIPT#
func_root
func_apt

echo "
Popcorn-Time $version for Ubuntu-Linux
=====================================
Popcorn Time streams movies from Torrents.
Downloading copyrighted material may be illegal in your country.
!!! Use at your own risk !!!
"

sudo test 

case $1 in
    -update)
        option="-update"
        ;;
    *)
        [ -n "$1" ] && echo -e "\nUnauthorized option '$1' will be ignored."
        ;;
esac

func_ptexists $option
func_dependencies
func_build $option
func_install $option
func_end $option

echo "=================================================
Popcorn-Time is now installed !

Type «popcorn-time --help» for more information."
exit 0

Uninstallation

A simple popcorn-time --uninstall should be enough. If not, clear those files :

  • /opt/Popcorn-Time
  • ~/.config/Popcorn-Time
  • /usr/share/pixmaps/popcorntime.png
  • /usr/bin/popcorn-time
  • /usr/share/applications/popcorn-time.desktop
14
  • This is great, thanks! Just for others' information, I had to upgrade to a later version of nodejs to prevent the grunt-cli install from failing. Ubuntu sources only support up to version 0.6. Instructions to upgrade are available here: stackoverflow.com/questions/7214474/…
    – Templar
    Mar 13, 2014 at 4:02
  • It would be great if you could also link to those bugs... so in case there is a workaround or it gets fixed, we can easily edit and maintain the post. I tried to link them, but I'am not sure of the exact ones you are talking about.. :)
    – Aditya
    Mar 13, 2014 at 6:29
  • As of March, 14, Popcorn-Time is now down.
    – MrVaykadji
    Mar 15, 2014 at 0:11
  • Is this up-to-date?
    – Seth
    Mar 16, 2014 at 2:57
  • Project seems abandonned since march 14 :/ this works with the current sources on github, but it will probably never get out of beta
    – MrVaykadji
    Mar 16, 2014 at 3:14
7

Manually :

1) Get the files

Clone the repo with git (install it if needed) :

git clone https://git.popcorntime.io/popcorntime/desktop.git

2) Install node.js

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

3) Install node.js requiered dependencies

sudo npm install -g grunt-cli bower

4) enter the directory

cd desktop

5) Install Popcorn-Time dependencies

npm install

6) Build with grunt

grunt build

7) Get the built executable

You'll find the executable inside the build/releases folder

7bis) Start the live-development

grunt start

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .