├── twitch_key ├── foo.flv ├── assets ├── Pokemon Red.zip ├── Pokemon Yellow.gb └── vbam-gtk_1.8.0.1001-1~getdeb3_amd64.deb ├── README.md ├── audio.sh ├── levelGen.sh ├── runPortal.sh ├── twitch2.sh ├── twitch.sh ├── local.sh ├── run.sh ├── LICENSE ├── control.sh └── app.rb /twitch_key: -------------------------------------------------------------------------------- 1 | live_57524215_7uhYJzNOoU7NfCpnjmguUF17tapiTA 2 | -------------------------------------------------------------------------------- /foo.flv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i/Capitalism-Plays-Pokemon/master/foo.flv -------------------------------------------------------------------------------- /assets/Pokemon Red.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i/Capitalism-Plays-Pokemon/master/assets/Pokemon Red.zip -------------------------------------------------------------------------------- /assets/Pokemon Yellow.gb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i/Capitalism-Plays-Pokemon/master/assets/Pokemon Yellow.gb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Capitalism-Plays-Pokemon 2 | ======================== 3 | 4 | Money talks... 5 | Play pokemon using Venmo. 6 | -------------------------------------------------------------------------------- /assets/vbam-gtk_1.8.0.1001-1~getdeb3_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i/Capitalism-Plays-Pokemon/master/assets/vbam-gtk_1.8.0.1001-1~getdeb3_amd64.deb -------------------------------------------------------------------------------- /audio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash pactl 2 | load-module module-null-sink sink_name=mix 3 | pactl load-module module-loopback sink=mix 4 | pactl load-module module-loopback sink=mix 5 | -------------------------------------------------------------------------------- /levelGen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "music:default" 4 | echo "message1:Welcome to custom made level!" 5 | echo "NNN@N" 6 | echo "NN N" 7 | echo "NN Q " 8 | echo "NN NNN NNNNNN" 9 | #jp2a $1 | sed 's/[^\.]/N/g' | sed 's/\./ /g' 10 | jp2a $1 | sed "s/[^\.\: \"';,]/N/g" | sed "s/[\.\"'\:;,]/ /g" | sed 's/^/NN NN/' 11 | echo "name:Custom" 12 | -------------------------------------------------------------------------------- /runPortal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # kill ascii portal 4 | kill $(ps aux | grep asciiportal | head -n 1 | awk '{print $2}') 5 | 6 | # move the level 7 | rm ~/Downloads/asciiportal/maps/001.txt 8 | ./levelGen.sh $1 > 001.txt 9 | mv 001.txt ~/Downloads/asciiportal/maps/ 10 | 11 | # restart the game 12 | cd ~/Downloads/asciiportal/ 13 | ./asciiportal & 14 | cd ~/Capitalism-Plays-Pokemon/ 15 | 16 | 17 | -------------------------------------------------------------------------------- /twitch2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | TOPXY="$1,$2" 3 | INRES="1280x720" 4 | OUTRES="852x480" 5 | FPS="30" 6 | QUAL="medium" 7 | STREAM_KEY="live_57524215_7uhYJzNOoU7NfCpnjmguUF17tapiTA" 8 | avconv \ 9 | -f x11grab -s $INRES -r "$FPS" -i :0.0+$TOPXY \ 10 | -f alsa -ac 2 -i pulse \ 11 | -vcodec libx264 -s $OUTRES -preset $QUAL \ 12 | -acodec libmp3lame -ar 44100 -threads 4 -qscale 3 -b 712000 -bufsize 512k \ 13 | -f flv "rtmp://live.justin.tv/app/$STREAM_KEY" 14 | -------------------------------------------------------------------------------- /twitch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | INRES="1366x768" # input resolution 4 | FPS="20" # target FPS 5 | QUAL="fast" 6 | URL="rtmp://live-jfk.twitch.tv/app/live_57524215_7uhYJzNOoU7NfCpnjmguUF17tapiTA" #flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" 7 | 8 | ffmpeg \ 9 | -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ 10 | -f alsa -i hw:0,0 -ac 2 -vcodec libx264 -crf 30 -preset "$QUAL" -s "$INRES" \ 11 | -acodec libmp3lame -ab 96k -ar 44100 -threads 0 -pix_fmt yuv420p \ 12 | -f flv "$URL" 13 | -------------------------------------------------------------------------------- /local.sh: -------------------------------------------------------------------------------- 1 | 2 | INRES="1366x768" # input resolution 3 | FPS="15" # target FPS 4 | QUAL="fast" # one of the many FFMPEG preset 5 | URL="rtmp://live-jfk.twitch.tv/app/live_57524215_7uhYJzNOoU7NfCpnjmguUF17tapiTA" #flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" 6 | 7 | ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ 8 | -f alsa -i hw:0,0 -ac 2 -vcodec libx264 -crf 30 -preset "$QUAL" -s "1280x720" \ 9 | -acodec libmp3lame -ab 96k -ar 44100 -threads 0 -pix_fmt yuv420p \ 10 | -f flv "./foo.flv" 11 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | INRES="1366x768" # input resolution 2 | FPS="24" # target FPS 3 | QUAL="fast" # one of the many FFMPEG preset 4 | URL="rtmp://live-jfk.twitch.tv/app/live_57524215_7uhYJzNOoU7NfCpnjmguUF17tapiTA 5 | " #flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" 6 | 7 | ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ │··· 8 | -f alsa -f mp3 -ac 2 -vcodec libx264 -crf 30 -preset "$QUAL" -s "852x480" \ 9 | -acodec libmp3lame -ab 96k -ar 44100 -threads 0 -pix_fmt yuv420p \ 10 | -f flv "$URL" 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ian Lozinski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /control.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$(whoami)" == 'jhuang' ]; then 4 | WID=`xdotool search --name "VBA-M" | head -1` 5 | fi 6 | if [ "$(whoami)" == 'ian' ]; then 7 | WID=`xdotool search --name "VisualBoyAdvance" | head -1` 8 | fi 9 | if [ "$(whoami)" == 'root' ]; then 10 | WID=`xdotool search --name "VisualBoyAdvance" | head -1` 11 | fi 12 | 13 | function goDown { 14 | xdotool windowactivate $WID 15 | sleep 0.1 16 | xdotool keydown Down 17 | sleep 0.25 18 | xdotool keyup Down 19 | } 20 | 21 | function goUp { 22 | xdotool windowactivate $WID 23 | sleep 0.1 24 | xdotool keydown Up 25 | sleep 0.25 26 | xdotool keyup Up 27 | } 28 | 29 | function goLeft { 30 | xdotool windowactivate $WID 31 | sleep 0.1 32 | xdotool keydown Left 33 | sleep 0.25 34 | xdotool keyup Left 35 | } 36 | 37 | function goRight { 38 | xdotool windowactivate $WID 39 | sleep 0.1 40 | xdotool keydown Right 41 | sleep 0.25 42 | xdotool keyup Right 43 | } 44 | 45 | function pressZ { 46 | xdotool windowactivate $WID 47 | sleep 0.1 48 | xdotool keydown z 49 | sleep 0.25 50 | xdotool keyup z 51 | } 52 | 53 | function pressX { 54 | xdotool windowactivate $WID 55 | sleep 0.1 56 | xdotool keydown x 57 | sleep 0.25 58 | xdotool keyup x 59 | } 60 | 61 | 62 | function pressEnter { 63 | xdotool windowactivate $WID 64 | sleep 0.1 65 | xdotool keydown Return 66 | sleep 0.25 67 | xdotool keyup Return 68 | } 69 | 70 | case $1 in 71 | "down") 72 | goDown 73 | ;; 74 | "up") 75 | goUp 76 | ;; 77 | "left") 78 | goLeft 79 | ;; 80 | "right") 81 | goRight 82 | ;; 83 | "a") 84 | pressZ 85 | ;; 86 | "b") 87 | pressX 88 | ;; 89 | "start") 90 | pressEnter 91 | ;; 92 | 93 | esac 94 | -------------------------------------------------------------------------------- /app.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | require 'sinatra' 3 | require 'cgi' 4 | require 'pp' 5 | 6 | set :bind, '0.0.0.0' 7 | 8 | # Used when setting URL on Venmo 9 | # https://venmo.com/account/settings/developers 10 | get '/webhook_url' do 11 | params[:venmo_challenge].to_s 12 | end 13 | 14 | post '/webhook_url' do 15 | @json = JSON.parse request.body.read 16 | note = parse_note @json['data']['note'].downcase 17 | `./control.sh #{note}` 18 | 19 | 200 20 | end 21 | 22 | get '/' do 23 | 'hi' 24 | end 25 | 26 | post '/email' do 27 | @subject = "" 28 | @text = "" 29 | request.POST.each do |k,v| 30 | @subject = v if k == "subject" 31 | @text = v if k == "text" 32 | end 33 | @subject = parse_note @subject.downcase 34 | puts @subject 35 | `./control.sh #{@subject}` 36 | 37 | 200 38 | end 39 | 40 | 41 | post '/level' do 42 | request.POST.each do |k,v| 43 | #puts "#{k}, #{v}" if k == "attachment1" 44 | if k == "attachment1" 45 | puts "#{v[:filename]}" 46 | file = v[:tempfile] 47 | filePath = File.readlink("/proc/self/fd/#{file.fileno}") 48 | # overwrite if necessary 49 | `rm #{v[:filename]}` 50 | `mv #{filePath} #{v[:filename]}` 51 | `./runPortal.sh #{v[:filename]}` 52 | end 53 | end 54 | 55 | 200 56 | end 57 | 58 | 59 | 60 | 61 | 62 | 63 | # OLD STUFF 64 | 65 | 66 | # parse venmo input into single button press 67 | def parse_note note 68 | note.chomp! 69 | note.strip! 70 | if note.include? "start" 71 | return "start" 72 | elsif note.include? "left" 73 | return "left" 74 | elsif note.include? "down" 75 | return "down" 76 | elsif note.include? "right" 77 | return "right" 78 | elsif note.include? "up" 79 | return "up" 80 | elsif note=='b' 81 | return "b" 82 | elsif note=='a' 83 | return "a" 84 | end 85 | 86 | nil 87 | end 88 | 89 | --------------------------------------------------------------------------------