从源文件安装爆米花时间


28

如何安装Popcorn Time beta

我在他们的网站上看到他们只提供64位安装文件,但源代码是开放的。

我不能用平常的方式./configure && make。那么,我该怎么办?


我使用的是64位xubuntu 14.04,我从他们的网站上下载了beta 3.0程序包,将其解压缩并运行./Popcorn-Time了大约20分钟,这是说initializing popcorn please wait....它将最终起作用还是应该按照您的指示使其起作用等待?
Lynob 2014年

它不起作用,初始化大约需要0.3秒。问题一定存在于其他地方,我不认为它会与官方版本相比有什么不同,而是基于开发代码(alpha)。报告问题:github.com/popcorn-official/popcorn-app/issues
MrVaykadji 2014年

我确实尝试遵循您的第二个答案,尝试修复python文件,希望修复错误,但没有用,我遵循了您的第一个答案,它很有效,谢谢。请注意,如果您可以编辑脚本以检查是否安装了依赖项,那就太好了,我在运行脚本之前就已经安装了它们,但是您的脚本花了5分钟的时间尝试安装它们,因此可以轻松跳过该部分。并请删除该install all选项,因为它不能同时运行mac和win和linux,此选项只是浪费时间,没有人可以使用它
Lynob 2014年

呃,为什么不能有一台Macbook Air和一台带有Ubuntu Windows的PC?这就是“选择”的全部要点,能够进行选择。如果您不希望构建“ all”,则不应键入“ all”。对于依赖项,如果您正在谈论nodejs并且已经拥有它,则只需经历“ apt-get更新”,没什么大不了的。如果您在谈论npm依赖关系,那么我们将在使用它们时必须将它们安装在文件夹中,而不是计算机上的其他位置:因此这是必要的。
MrVaykadji 2014年

但他们的网站上已经有适用于Windows和Mac的软件包。他们不是在工作吗?是否需要像linux软件包那样构建?
Lynob 2014年

Answers:


21

该脚本将帮助您从Github来源在Ubuntu Linux上构建Popcorn Time dev-0.3

它可以在Ubuntu 12.04和14.04 64bits上完美运行,但应该与每个维护的版本和每种体系结构一起使用。

要从源代码构建和安装Popcorn-Time,您需要nodejsnpmnpm使用bowergrunt-cli构建文件:这就是为什么您不能使用通常的./configure

注意:安装文件当前存在1个错误:nodejs二进制文件的名称错误,您可以通过从'nodejs'到'node'的简单符号链接来修复它。

注意:在12.04上没有libudev.so.1,因此我们需要将其与libudev.so.0进行符号链接

如何

  1. 将以下行复制并粘贴到文本文件中,在此示例中,我将其命名为脚本

  2. 然后,使用您的终端并启动脚本:

    bash script
    
  3. 按照屏幕上的说明操作:

    • 接受免责声明
    • 选择要构建的平台(mac,win,linux32-64)
    • 如果需要,使用快捷方式和命令行选项安装Popcorn-Time
    • 如果您不想再删除建筑文件
    • 如果您以后不想使用此脚本,请删除该脚本用于构建PT的软件包
    • 瞧。

这大约需要10到30分钟才能完成。


#!/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

解除安装

一个简单的popcorn-time --uninstall就足够了。如果没有,请清除这些文件:

  • / opt /爆米花时间
  • 〜/ .config /爆米花时间
  • /usr/share/pixmaps/popcorntime.png
  • / usr / bin /爆米花时间
  • /usr/share/applications/popcorn-time.desktop

太好了,谢谢!仅出于其他信息,我必须升级到更高版本的nodejs,以防止grunt-cli安装失败。Ubuntu源代码最多仅支持0.6版。升级说明可在此处找到:stackoverflow.com/questions/7214474/…–
圣殿骑士

如果您还可以链接到这些错误,那就太好了...因此,如果有解决方法或已解决问题,我们可以轻松地编辑和维护该帖子。我试图将它们链接起来,但是我不确定您在说的是什么。.:)
Aditya 2014年

截至3月14日,“爆米花时间”现已关闭。
MrVaykadji 2014年

这是最新的吗?
塞斯(Seth)2014年

自3月14日以来,该项目似乎已被放弃://此项目适用于github上的当前资源,但它可能永远不会脱离beta
MrVaykadji 2014年

7

手动:

1)获取文件

克隆仓库git(如果需要,安装它):

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

2)安装node.js

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

3)安装node.js所需的依赖项

sudo npm install -g grunt-cli bower

4)输入目录

cd desktop

5)安装爆米花时间依赖

npm install

6)用咕unt声建造

grunt build

7)获取构建的可执行文件

您会在文件build/releases夹中找到可执行文件

7之二)开始现场开发

grunt start
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.